More Info
Private Name Tags
Latest 25 from a total of 60 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Buy Tokens | 51656205 | 451 days ago | IN | 0 POL | 0.02668586 | ||||
Buy Tokens | 51648037 | 451 days ago | IN | 0 POL | 0.03505799 | ||||
Buy Tokens | 50582531 | 479 days ago | IN | 0 POL | 0.03949427 | ||||
Buy Tokens | 50399061 | 483 days ago | IN | 0 POL | 0.00440136 | ||||
Buy Tokens | 50335877 | 485 days ago | IN | 0 POL | 0.107969 | ||||
Buy Tokens | 50093589 | 491 days ago | IN | 0 POL | 0.00637239 | ||||
Buy Tokens | 50064366 | 492 days ago | IN | 0 POL | 0.01184458 | ||||
Buy Tokens | 50022183 | 493 days ago | IN | 0 POL | 0.04984803 | ||||
Buy Tokens | 50019914 | 493 days ago | IN | 0 POL | 0.34892909 | ||||
Buy Tokens | 49973150 | 494 days ago | IN | 0 POL | 0.01989564 | ||||
Buy Tokens | 49865638 | 497 days ago | IN | 0 POL | 0.01076848 | ||||
Buy Tokens | 49704801 | 501 days ago | IN | 0 POL | 0.03463312 | ||||
Buy Tokens | 49696910 | 501 days ago | IN | 0 POL | 0.04160653 | ||||
Buy Tokens | 49668683 | 502 days ago | IN | 0 POL | 0.03072582 | ||||
Buy Tokens | 49667936 | 502 days ago | IN | 0 POL | 0.03389517 | ||||
Buy Tokens | 49667513 | 502 days ago | IN | 0 POL | 0.03376258 | ||||
Buy Tokens | 49650336 | 502 days ago | IN | 0 POL | 0.03312885 | ||||
Buy Tokens | 49629536 | 503 days ago | IN | 0 POL | 0.03619196 | ||||
Buy Tokens | 49624367 | 503 days ago | IN | 0 POL | 0.03388692 | ||||
Buy Tokens | 49616555 | 503 days ago | IN | 0 POL | 0.03786854 | ||||
Buy Tokens | 49588737 | 504 days ago | IN | 0 POL | 0.00963669 | ||||
Buy Tokens | 49587806 | 504 days ago | IN | 0 POL | 0.00181727 | ||||
Buy Tokens | 49587806 | 504 days ago | IN | 0 POL | 0.00171298 | ||||
Buy Tokens | 49587806 | 504 days ago | IN | 0 POL | 0.00641961 | ||||
Buy Tokens | 49587805 | 504 days ago | IN | 0 POL | 0.00540656 |
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
49381566 | 509 days ago | Contract Creation | 0 POL |
Loading...
Loading
Contract Name:
OTCController
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion, Audited
Contract Source Code (Solidity Standard Json-Input format)Audit Report
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import "../../base/GOBValidCurrencies/GOBValidCurrencies.sol"; import "../../base/GOBWithdraw/GOBWithdraw.sol"; import "../vesting/Vesting.sol"; import "./IOTCController.sol"; /** * @title Guardians of the Ball - OTC_Controller * @author Matias Arazi - Guardians of the Ball * @notice It is a smart contract designed to sell a token in the OTC phase using stablecoins of the dollar. */ contract OTCController is IOTCController, AccessControl, GOBValidCurrencies, GOBWithdraw { using SafeERC20 for IERC20Metadata; using EnumerableSet for EnumerableSet.AddressSet; // Flags to manage the sale state bool public isSaleOpen = false; bool public alreadyOpen = false; // Role constants bytes32 public constant SALES_TRIGGERER_ROLE = keccak256("SALES_TRIGGERER_ROLE"); bytes32 public constant PRICE_MANAGER_ROLE = keccak256("PRICE_MANAGER_ROLE"); bytes32 public constant WITHDRAW_ROLE = keccak256("WITHDRAW_ROLE"); // Decimal precision for token amounts uint256 public immutable decimals; // Addresses and contracts address public vesting; address public immutable fundingWallet; IERC20Metadata public immutable sellingToken; uint256 public price; /** * @dev Emitted when tokens are sold to a beneficiary using a stablecoin. * @param beneficiary The address of the beneficiary who purchased tokens. * @param stablecoinAddress The address of the stablecoin used for the purchase. * @param amount The amount of tokens purchased. */ event Sold(address indexed beneficiary, address indexed stablecoinAddress, uint256 amount); /** * @dev Modifier to check if the sale is open. * This modifier verifies whether the `isSaleOpen` flag is true before allowing the function to proceed. * If the sale is not open, the function call will be reverted. */ modifier saleIsOpen() { require(isSaleOpen, "OTCController: Sales are closed"); _; } /** * @notice Constructor to initialize the contract. * @param decimals_ Decimal precision for token price. * @param fundingWalletAddress_ Address of the wallet containing funds for sales. * @param sellingTokenAddress_ Address of the token to be sold. * * Requirements: * - The stablecoins address must be unique in the list. * - The stablecoins address decimals MUST be less than 'decimals_'. */ constructor( address[] memory stablecoins_, uint256 decimals_, address fundingWalletAddress_, address sellingTokenAddress_ ) { sellingToken = IERC20Metadata(sellingTokenAddress_); // Cannot be greater than 6 to be able to work with USDT and USDC require(decimals_ <= 6, "Price decimals must be <= 6"); require( decimals_ <= sellingToken.decimals(), "Price decimals must be <= sellingToken decimals" ); // Assign the contract deployer as the default admin role _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); decimals = decimals_; fundingWallet = fundingWalletAddress_; // Add the initial stablecoins to the set for (uint256 i = 0; i < stablecoins_.length; ) { require(!_currencies.contains(stablecoins_[i]), "Currency already added"); _addCurrencyDec(stablecoins_[i]); unchecked { ++i; } } } /** * @notice Check if the sale is available. * @return A boolean indicating whether fundingWallet has funds and has allowance. */ function checkAvailability() external view returns (bool) { uint256 minPurchase = 10 ** (sellingToken.decimals() - decimals); return sellingToken.balanceOf(fundingWallet) > minPurchase && sellingToken.allowance(fundingWallet, address(this)) > minPurchase; } /** * @notice Purchase tokens using a stablecoin. * @param currency The address of the stablecoin to use for the purchase. * @param amount The amount of tokens you want to buy in 'decimals'. * @dev If you want to buy 14.5 tokens, amount should be equal to 14.5 * 10^decimals * * * Requirements: * - The stablecoin address must be valid. * - The caller must pay with a valid stablecoin. */ function buyTokens( address currency, uint256 amount ) external validCurrency(currency) saleIsOpen { require(amount != 0, "OTCController: amount is zero"); require(price != 0, "OTCController: price is zero"); IERC20Metadata _currency = IERC20Metadata(currency); uint256 finalPrice = (price * amount * (10 ** (_currency.decimals()))) / (10 ** (2 * decimals)); _currency.safeTransferFrom(_msgSender(), address(this), finalPrice); uint tokenAmount = amount * 10 ** (sellingToken.decimals() - decimals); sellingToken.safeTransferFrom(fundingWallet, vesting, tokenAmount); IVesting vestingContract = IVesting(vesting); vestingContract.createAgenda(_msgSender(), tokenAmount); emit Sold(_msgSender(), currency, tokenAmount); } /** * @notice Set the price for purchasing tokens. * @param _price The new price in stablecoins. * * Requirements: * - The new price must be greater than zero. * - The caller must have the PRICE_MANAGER_ROLE. */ function setPrice(uint256 _price) external onlyRole(PRICE_MANAGER_ROLE) { require(_price > 0, "OTCController: Price MUST be greater than zero"); price = _price; emit PriceSetted(_msgSender(), _price); } /** * @notice Add a stablecoin to the list of accepted stablecoins. * @param currency The address of the stablecoin to add. * * Requirements: * - The token address must not be an accepted stablecoin. * - The token address must be a valid ERC20 token. * - The token address decimals MUST be less than 'decimals'. * - The caller must have the PRICE_MANAGER_ROLE. */ function addCurrency(address currency) external onlyRole(PRICE_MANAGER_ROLE) { _addCurrencyDec(currency); } /** * @notice Remove a stablecoin from the list of accepted stablecoins. * @param currency The address of the stablecoin to remove. * * Requirements: * - The caller must have the PRICE_MANAGER_ROLE. */ function removeCurrency(address currency) external onlyRole(PRICE_MANAGER_ROLE) { _removeCurrency(currency); } /** * @notice Open the sale, allowing token purchases. * @param initialAuthorizers Addresses initially authorized to interact with the vesting contract. * @param initialAuthorizedSpenders Addresses initially authorized to spend tokens from the vesting contract. * @param releaseTime The release time for the vesting contract. * * Requirements: * - The funding wallet must have allocated allowance to this contract. * - Sales must not have been opened previously. * - Sales must not have been closed previously. * - A price must be assigned. * - At least one stablecoin must be added. * - The caller must have the SALES_TRIGGERER_ROLE. */ function openSale( address[] calldata initialAuthorizers, address[] calldata initialAuthorizedSpenders, uint256 releaseTime ) external onlyRole(SALES_TRIGGERER_ROLE) { require( sellingToken.allowance(fundingWallet, address(this)) > 0, "OTCController: Controller needs allowance" ); require(!isSaleOpen, "OTCController: Sales are already opened"); require(!alreadyOpen, "OTCController: Unable to open sales again"); require(price > 0, "OTCController: Price is not assigned"); require(_currencies.length() > 0, "OTCController: Stablecoin not added"); Vesting vestingContract = new Vesting( address(sellingToken), initialAuthorizers, initialAuthorizedSpenders, releaseTime ); vesting = address(vestingContract); isSaleOpen = true; alreadyOpen = true; emit SaleOpened(); } /** * @notice Close the token sale, preventing further purchases. * * Requirements: * - Sales must have been opened previously. * - The caller must have the SALES_TRIGGERER_ROLE. */ function closeSale() external onlyRole(SALES_TRIGGERER_ROLE) saleIsOpen { isSaleOpen = false; emit SaleClosed(); } /** * @notice See {GOBWithdraw-_withdrawSet}. */ function withdrawCurencies() external onlyRole(WITHDRAW_ROLE) { require(_withdrawSet(_currencies), "OTCController: No balance available"); } /** * @notice See {GOBWithdraw-_withdraw}. */ function withdraw(address token, uint256 amount) external onlyRole(WITHDRAW_ROLE) { require(amount > 0, "OTCController: Amount cannot be zero"); _withdraw(token, amount); } /** * @notice Vaidates newCurrency decimals. */ function _addCurrencyDec(address newCurrency) private { require( IERC20Metadata(newCurrency).decimals() >= decimals, "OTCController: Currency decimals too low" ); _addCurrency(newCurrency); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../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 => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface 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 v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // 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. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 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 + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @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 v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = 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), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(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) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** * @author Alejandro Garrido - Guardians of the Ball. * @title Guardians of the Ball - GOBValidCurrencies. * @dev Helper to manage a list of accepted currencies in inherited contracts. * Child contracts can call _addCurrency(), _removeCurrency(), and use the modifier validCurrency(). * They can also access the list in the internal AddressSet `_currencies`. */ abstract contract GOBValidCurrencies { using EnumerableSet for EnumerableSet.AddressSet; /** * @dev Emitted when new valid currency is added. */ event CurrencyRemoved(address indexed newCurrency); /** * @dev Emitted when a valid currency is removed. */ event CurrencyAdded(address indexed newCurrency); modifier validCurrency(address currency) { require(_currencies.contains(currency), "GOBValidCurrencies: Invalid currency"); _; } // Accepted currencies. EnumerableSet.AddressSet internal _currencies; /** * @notice Returns all ERC20 accepted as payment. * @return Array with all ERC20 addresses. */ function validCurrencies() external view returns (address[] memory) { return _currencies.values(); } /** * @notice Check if a currency is listed. * @param currency The ERC20 address. * @return Whether the ERC20 is listed or not. */ function isValidCurrency(address currency) external view returns (bool) { return _currencies.contains(currency); } /** * @notice Adds a new currency to the list of ERC20s accepted. * * Emits {CurrencyAdded}. * * @param newCurrency ERC20 address (ie: usdc). */ function _addCurrency(address newCurrency) internal { require(newCurrency != address(0), "GOBValidCurrencies: Zero address"); require(!_currencies.contains(newCurrency), "GOBValidCurrencies: Currency already exists"); _currencies.add(newCurrency); emit CurrencyAdded(newCurrency); } /** * @notice Removes an ERC20 from the accepted list of currencies. * * Emits {CurrencyRemoved}. * * @param currency ERC20 address. */ function _removeCurrency(address currency) internal validCurrency(currency) { require(_currencies.length() > 1, "GOBValidCurrencies: Only one currency left"); _currencies.remove(currency); emit CurrencyRemoved(currency); } }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; /** * @author Matias Arazi - Guardians of the Ball. * @title Guardians of the Ball - GOBWithdraw. * @dev Helper to manage withdraw functions in inherited contracts. * Child contracts can call _withdraw(), _withdrawSet(). */ abstract contract GOBWithdraw is Context { using EnumerableSet for EnumerableSet.AddressSet; using SafeERC20 for IERC20; /** * @dev Emitted when funds are withdrawn from the contract for a specific tokenAddress. * @param callerAddress The address of the caller who initiated the withdrawal. * @param tokenAddress The address of the tokenAddress from which funds are withdrawn. * @param amount The amount of tokenAddress withdrawn. */ event Withdrawn(address indexed callerAddress, address indexed tokenAddress, uint256 amount); /** * @notice Withdraw funds from the contract for a specific tokenAddress. * @param token The address of the tokenAddress to withdraw from. * @param amount The amount of tokenAddress withdrawn. * * Requirements: * - The token address must be a valid ERC20 token. (address must be an erc20) */ function _withdraw(address token, uint256 amount) internal { IERC20 currency = IERC20(token); currency.safeTransfer(msg.sender, amount); emit Withdrawn(_msgSender(), token, amount); } /** * @notice Withdraw funds from the contract for multiple token addresses. * @param tokenSet AddressSet of tokens in storage. * @return isWithdrawn Withdrawn at least one of the tokens in `tokenSet` */ function _withdrawSet( EnumerableSet.AddressSet storage tokenSet ) internal returns (bool isWithdrawn) { uint256 balance; uint256 len = tokenSet.length(); IERC20 currency; for (uint256 i = 0; i < len; ) { currency = IERC20(tokenSet.at(i)); balance = currency.balanceOf(address(this)); if (balance > 0) { _withdraw(address(currency), balance); isWithdrawn = true; } unchecked { i++; } } } }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /** * @title Guardians of the Ball - IOTCController * @author Guardians of the Ball * @notice OTCController contract Interface */ interface IOTCController { /** * @dev Emitted when the price for purchasing tokens is set. * @param callerAddress The address of the caller who set the price. * @param price The new price in stablecoins. */ event PriceSetted(address indexed callerAddress, uint256 price); /** * @dev Emitted when the token sale is opened for purchases. */ event SaleOpened(); /** * @dev Emitted when the token sale is closed, preventing further purchases. */ event SaleClosed(); /** * @dev Returns if sales are open or not. */ function isSaleOpen() external view returns (bool); /** * @notice Purchase tokens using a stablecoin. * @param _stablecoin The address of the stablecoin to use for the purchase. * @param amount The amount of stablecoins to exchange for tokens. * * Requirements: * - The stablecoin address must be valid. * - The caller must pay with a valid stablecoin. */ function buyTokens(address _stablecoin, uint256 amount) external; }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; /** * @title Guardians of the Ball - IVesting * @author Guardians of the Ball * @notice Vesting contract Interface */ interface IVesting { /** * @dev Agenda struct. * @param account The address of the agenda owner. * @param amount The amount of tokens currently being locked, amount is substracted for each withdrawal/authorizedWithdrawal. * @param endTime The end time of the vesting in unix timestamp. */ struct Agenda { uint256 amount; uint256 endTime; } /** * @notice Emitted when a new agenda is created by the `OTC_CONTROLLER_ROLE`. * @param account The address of the agenda owner. * @param amount The amount of tokens to be vested. * @param agendaId the hash identifier of the agenda * @param start The start time of the vesting in unix timestamp. * @param end The end time of the vesting in unix timestamp. */ event AgendaCreated( address indexed account, uint256 amount, bytes32 agendaId, uint256 start, uint256 end ); /** * @notice Emitted when a withdrawal or authorized withdrawal is made. * @param account The address of the agenda owner. * @param operator The address of the caller, if `operator` == `account` then it is a withdrawal, else, an authorized withdrawal. * @param amount The amount of tokens withdrawn. */ event Withdrawn(address indexed account, address indexed operator, uint256 amount); /** * @dev Returns the address of the token being vested. */ function token() external view returns (address); /** * @dev Returns available balance of `account`. * @param account The address to query. */ function balanceOf(address account) external view returns (uint256); /** * @dev Returns locked balance of `account`. * @param account The address to query. */ function totalLocked(address account) external view returns (uint256); /** * @dev Returns all vested balance of `account`. * @param account The address to query. */ function totalVested(address account) external view returns (uint256); /** * @dev withdraws all available tokens for the sender. * * Emits a {Withdrawn} event. * * Requirements: * - the agenda must be unlocked. * - the sender must have a non-zero balance. */ function withdraw() external; /** * @dev withdraws `amount` tokens for `agendaOwner`. * @param agendaOwner address to spend `amount` tokens from * @param amount The amount of tokens to spend. * * Emits a {Withdrawn} event. * * Requirements: * - `agendaOwner` must have a non-zero balance. * - Must be called by `AUTHORIZED_SPENDER_ROLE` * - `agendaOwner` must have approved operator or caller to spend `amount` tokens */ function withdrawFrom(address agendaOwner, uint256 amount) external; /** * @dev Creates a new agenda that locks `amount` tokens for `beneficiary` until `block.timestamp` + `durationPerAgenda`. * @param beneficiary The address of the agenda owner. * @param amount The amount of tokens to be vested. * * Emits a {AgendaCreated} event. * * Requirements: * - Must be called by `OTC_CONTROLLER_ROLE` * - `beneficiary` must not be the zero address. * - `amount` must be non-zero. * - `beneficiary` must have approved contract to spend `amount` tokens. */ function createAgenda(address beneficiary, uint256 amount) external; }
//...........,,..,,,,,,,.................................. //......###(#######(,,,,.##########....######(((((*....... //......%%%%%%%%%%%%%.,#%%%%%%%%%%%%%..%%%%%%%%%%%%%...... //......%%%%%...%%%&%,,%%&&&,,,,&&%%%..%%%%%...%%%%%...... //......&&&&&...&&.,,,,&&&&&,***&&&&&..&&&&&...&&&&&...... //......&&&&&.,,,,,,,,*&@@@@///*@@&@&,.&&&&&...&&&&&...... //.....*@@@@@.@@@@@@&**@@@@@%%#/@@@@,,&@@@@@@@@@@@@....... //......@@@@@.@@@#@@@**&@@@@%&#(@@@@@,,@@@@@@@@@@@@@...... //......&&&&&...@@@@@,*&@@@@////@@@@@,,&&&&&...&&&&&...... //......&&&&&...&&&&&,,&&&&@***,&&&&&,.&&&&&...&&&&&...... //......%%%&&...&&&&&,,%&&&&,,,,&&&&&..&&&%%...&&&&&...... //......%%%%%%%%%%%%%..#%%%%%%%%%%%%#..%%%%%%%%%%%%%...... //........................................................ // SPDX-License-Identifier: MIT pragma solidity ^0.8.18; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "./IVesting.sol"; import "../otc/IOTCController.sol"; /** * @title Guardians of the Ball - Vesting * @author Guardians of the Ball * @notice The Vesting contract allows the management of locked tokens and their scheduled release in a given period of time. * The tokens can be transferred to a list of authorized addresses, possibly just one that is the Marketplace, * allowing the buyer to purchase NFTs during the lock-in period. * This contract only accepts the blocking of a specific ERC20 token. * Each block (or vesting) is known internally as an “agenda”. */ contract Vesting is IVesting, AccessControl { using Address for address; using SafeERC20 for IERC20; bytes32 public constant AUTHORIZER_ROLE = keccak256("AUTHORIZER_ROLE"); bytes32 public constant AUTHORIZED_SPENDER_ROLE = keccak256("AUTHORIZED_SPENDER_ROLE"); bytes32 public constant OTC_CONTROLLER_ROLE = keccak256("OTC_CONTROLLER_ROLE"); uint8 public constant AGENDAS_MAX = 255; uint256 internal constant UINT256_MAX = 2 ** 256 - 1; /** * @notice ERC20 token to vest. * @dev See {IVesting-token}. */ address public immutable token; /// @dev Duration of each agenda or Vesting. uint256 public immutable durationPerAgenda; /// @dev beneficiary => Agenda Nonce mapping(address => uint256) private _agendaNonce; /// @dev beneficiary => Agenda Nonce Start mapping(address => uint256) private _agendaNonceStart; /// @dev Agenda Id => Agenda (AgendaId = hash(address,nonce)) mapping(bytes32 => Agenda) private _agendas; /// @dev Controller contract address. IOTCController public immutable controller; /** * @param token_ ERC20 to vest * @param initialAuthorizers Initial addresses that will have AUTHORIZER_ROLE * @param initialAuthorizedSpenders Initial addresses that will have AUTHORIZED_SPENDER_ROLE * @param durationPerAgenda_ Duration of each agenda or Vesting in unix timestamp. */ constructor( address token_, address[] memory initialAuthorizers, address[] memory initialAuthorizedSpenders, uint256 durationPerAgenda_ ) { require(initialAuthorizers.length != 0, "Vesting: initialAuthorizers is empty"); _setRoleAdmin(AUTHORIZED_SPENDER_ROLE, AUTHORIZER_ROLE); _grantRole(OTC_CONTROLLER_ROLE, _msgSender()); controller = IOTCController(_msgSender()); token = token_; durationPerAgenda = durationPerAgenda_; for (uint256 i = 0; i < initialAuthorizedSpenders.length; ) { _grantRole(AUTHORIZED_SPENDER_ROLE, initialAuthorizedSpenders[i]); unchecked { ++i; } } for (uint256 i = 0; i < initialAuthorizers.length; ) { _grantRole(AUTHORIZER_ROLE, initialAuthorizers[i]); unchecked { ++i; } } } /** * @dev See {IVesting-balanceOf} */ function balanceOf(address account) external view returns (uint256) { (uint256 availableBalance, ) = _getBalances(account); return availableBalance; } /** * @dev See {IVesting-totalLocked} */ function totalLocked(address account) external view returns (uint256) { (uint256 availableBalance, uint256 totalVestedBalance) = _getBalances(account); return totalVestedBalance - availableBalance; } /** * @dev See {IVesting-totalVested} */ function totalVested(address account) external view returns (uint256) { (, uint256 totalVestedBalance) = _getBalances(account); return totalVestedBalance; } /** * @dev See {IVesting-withdraw} */ function withdraw() external { address account = _msgSender(); uint256 amountSubstracted = _substractBalances(account, UINT256_MAX, false); IERC20(token).safeTransfer(account, amountSubstracted); emit Withdrawn(account, account, amountSubstracted); } /** * @dev See {IVesting-withdrawFrom} */ function withdrawFrom( address agendaOwner, uint256 amount ) external onlyRole(AUTHORIZED_SPENDER_ROLE) { require(amount > 0, "Vesting: amount is zero"); require(agendaOwner != address(0), "Vesting: agendaOwner is the zero address"); address operator = _msgSender(); require( _substractBalances(agendaOwner, amount, true) == amount, "Vesting: amount exceeds balance" ); IERC20(token).safeTransfer(operator, amount); emit Withdrawn(agendaOwner, operator, amount); } /** * @dev See {IVesting-createAgenda} */ function createAgenda( address beneficiary, uint256 amount ) external onlyRole(OTC_CONTROLLER_ROLE) { require(beneficiary != address(0), "Vesting: beneficiary is the zero address"); require(amount != 0, "Vesting: amount is zero"); uint256 agendaNonce = _agendaNonce[beneficiary]; require( agendaNonce - _agendaNonceStart[beneficiary] <= AGENDAS_MAX, "Vesting: Max agendas reached for beneficiary" ); uint256 timestamp = block.timestamp; uint256 endTime = timestamp + durationPerAgenda; Agenda memory agenda = Agenda(amount, endTime); bytes32 agendaId = _hashAgenda(beneficiary, agendaNonce); _agendaNonce[beneficiary]++; _agendas[agendaId] = agenda; emit AgendaCreated(beneficiary, amount, agendaId, timestamp, endTime); } /** * @dev Iterates over all `account` agendas and returns the total available balance and the total locked balance. * @param account The address to query. * @return totalAvailableBalance The total available balance. * @return totalVestedBalance The total vested balance. * @dev total locked balance = total vested balance - total available balance */ function _getBalances( address account ) private view returns (uint256 totalAvailableBalance, uint256 totalVestedBalance) { uint256 nAgendas = _agendaNonce[account]; uint256 nsAgendas = _agendaNonceStart[account]; uint256 timestamp = block.timestamp; for (uint256 i = nsAgendas; i < nAgendas; ) { bytes32 agendaId = _hashAgenda(account, i); Agenda storage agenda = _agendas[agendaId]; if (timestamp >= agenda.endTime) { totalAvailableBalance += agenda.amount; } totalVestedBalance += agenda.amount; unchecked { ++i; } } } /** * @dev Iterates over all `account` agendas and subtracts `amountToSubtract` from them. * @param account The address to query. * @param amountToSubtract The amount to subtract. * @param substractLocked If true, subtracts from locked balances, otherwise from available balances. * @return amountSubstracted The total amount subtracted, it can be less than `amountToSubtract` if there is not enough balance. * If it is zero, it means that there is no balance. */ function _substractBalances( address account, uint256 amountToSubtract, bool substractLocked ) private returns (uint256 amountSubstracted) { uint256 nAgendas = _agendaNonce[account]; uint256 nsAgendas = _agendaNonceStart[account]; uint256 timestamp = block.timestamp; for (uint256 i = nsAgendas; i < nAgendas; i++) { if (amountToSubtract == 0) break; bytes32 agendaId = _hashAgenda(account, i); Agenda storage agenda = _agendas[agendaId]; // If agenda does not exist, continue if (agenda.endTime == 0) continue; if (!substractLocked && timestamp < agenda.endTime) continue; if (agenda.amount >= amountToSubtract) { agenda.amount -= amountToSubtract; amountSubstracted += amountToSubtract; amountToSubtract = 0; // If agenda is empty, delete it if (agenda.amount == 0) { _agendaNonceStart[account]++; delete _agendas[agendaId]; } } else { amountToSubtract -= agenda.amount; amountSubstracted += agenda.amount; _agendaNonceStart[account]++; delete _agendas[agendaId]; } } require(amountSubstracted > 0, "Vesting: balance is zero"); } /** * @dev Creates a unique identifier for a given agenda. * @param account the owner of the agenda * @param agendaNonce nonce, should be equal to `_agendaNonce[account]` */ function _hashAgenda(address account, uint256 agendaNonce) private pure returns (bytes32) { return keccak256(abi.encodePacked(account, agendaNonce)); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- Certik - Nov 9th, 2023 - Security Audit Report
Contract ABI
API[{"inputs":[{"internalType":"address[]","name":"stablecoins_","type":"address[]"},{"internalType":"uint256","name":"decimals_","type":"uint256"},{"internalType":"address","name":"fundingWalletAddress_","type":"address"},{"internalType":"address","name":"sellingTokenAddress_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCurrency","type":"address"}],"name":"CurrencyAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newCurrency","type":"address"}],"name":"CurrencyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"callerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"}],"name":"PriceSetted","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":[],"name":"SaleClosed","type":"event"},{"anonymous":false,"inputs":[],"name":"SaleOpened","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beneficiary","type":"address"},{"indexed":true,"internalType":"address","name":"stablecoinAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Sold","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"callerAddress","type":"address"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SALES_TRIGGERER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WITHDRAW_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"}],"name":"addCurrency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"alreadyOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"buyTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"checkAvailability","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"closeSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundingWallet","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":[{"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":[],"name":"isSaleOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"}],"name":"isValidCurrency","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"initialAuthorizers","type":"address[]"},{"internalType":"address[]","name":"initialAuthorizedSpenders","type":"address[]"},{"internalType":"uint256","name":"releaseTime","type":"uint256"}],"name":"openSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"currency","type":"address"}],"name":"removeCurrency","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellingToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_price","type":"uint256"}],"name":"setPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"validCurrencies","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vesting","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawCurencies","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60e06040526003805461ffff191690553480156200001c57600080fd5b50604051620046e7380380620046e78339810160408190526200003f91620005d9565b6001600160a01b03811660c0526006831115620000a35760405162461bcd60e51b815260206004820152601b60248201527f507269636520646563696d616c73206d757374206265203c3d2036000000000060448201526064015b60405180910390fd5b60c0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200010a9190620006dc565b60ff16831115620001765760405162461bcd60e51b815260206004820152602f60248201527f507269636520646563696d616c73206d757374206265203c3d2073656c6c696e60448201526e67546f6b656e20646563696d616c7360881b60648201526084016200009a565b6200018360003362000269565b60808390526001600160a01b03821660a05260005b84518110156200025e57620001d9858281518110620001bb57620001bb62000708565b602002602001015160016200030a60201b620013351790919060201c565b15620002285760405162461bcd60e51b815260206004820152601660248201527f43757272656e637920616c72656164792061646465640000000000000000000060448201526064016200009a565b6200025585828151811062000241576200024162000708565b60200260200101516200033160201b60201c565b60010162000198565b50505050506200071e565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000306576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002c53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6001600160a01b038116600090815260018301602052604081205415155b90505b92915050565b608051816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000373573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003999190620006dc565b60ff161015620003fd5760405162461bcd60e51b815260206004820152602860248201527f4f5443436f6e74726f6c6c65723a2043757272656e637920646563696d616c7360448201526720746f6f206c6f7760c01b60648201526084016200009a565b62000408816200040b565b50565b6001600160a01b038116620004635760405162461bcd60e51b815260206004820181905260248201527f474f4256616c696443757272656e636965733a205a65726f206164647265737360448201526064016200009a565b6200047e8160016200030a60201b620013351790919060201c565b15620004e15760405162461bcd60e51b815260206004820152602b60248201527f474f4256616c696443757272656e636965733a2043757272656e637920616c7260448201526a656164792065786973747360a81b60648201526084016200009a565b620004fc8160016200053460201b6200135a1790919060201c565b506040516001600160a01b038216907fe0390a89516146ccfb796a9fbfc3f7646282194c554d05020484599ee992dd5a90600090a250565b600062000328836001600160a01b038416600062000565838360009081526001919091016020526040902054151590565b6200059d575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200032b565b5060006200032b565b634e487b7160e01b600052604160045260246000fd5b80516001600160a01b0381168114620005d457600080fd5b919050565b60008060008060808587031215620005f057600080fd5b84516001600160401b03808211156200060857600080fd5b818701915087601f8301126200061d57600080fd5b8151602082821115620006345762000634620005a6565b8160051b604051601f19603f830116810181811086821117156200065c576200065c620005a6565b60405292835281830193508481018201928b8411156200067b57600080fd5b948201945b83861015620006a4576200069486620005bc565b8552948201949382019362000680565b809950505080890151965050505050620006c160408601620005bc565b9150620006d160608601620005bc565b905092959194509250565b600060208284031215620006ef57600080fd5b815160ff811681146200070157600080fd5b9392505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c051613f30620007b7600039600081816103950152818161074801528181610808015281816109e901528181610c5801528181610ddb01528181610ebe0152610f7c0152600081816103190152818161082c015281816109b801528181610e910152610f4c0152600081816102ac0152818161063c0152818161072701528181610dba01526114fc0152613f306000f3fe60806040523480156200001157600080fd5b5060043610620001e95760003560e01c806371b2cc3b116200010d578063cac4711011620000a3578063e02023a1116200007a578063e02023a1146200045a578063e0b68c121462000482578063ee55efee14620004aa578063f3fef3a314620004b457600080fd5b8063cac471101462000426578063d547741f1462000439578063e00ed8e8146200045057600080fd5b806391d1485411620000e457806391d1485414620003e5578063a035b1fe14620003fc578063a217fddf1462000406578063c5d3a107146200040f57600080fd5b806371b2cc3b146200038f5780638ab234b614620003b757806391b7f5ed14620003ce57600080fd5b806331aab75911620001835780633c4b40b8116200015a5780633c4b40b8146200031357806344c63eec14620003545780634fb92558146200036e578063537d22bd146200038557600080fd5b806331aab75914620002ce57806335eb618a14620002e557806336568abe14620002fc57600080fd5b80631d28031f11620001c45780631d28031f1462000241578063248a9ca3146200025a5780632f2ff15d146200028f578063313ce56714620002a657600080fd5b806301ffc9a714620001ee5780630752881a146200021a5780631a0813301462000233575b600080fd5b62000205620001ff36600462001ff6565b620004cb565b60405190151581526020015b60405180910390f35b620002316200022b3660046200203f565b62000503565b005b600354620002059060ff1681565b6200024b62000934565b6040516200021191906200206c565b620002806200026b366004620020bb565b60009081526020819052604090206001015490565b60405190815260200162000211565b62000231620002a0366004620020d5565b62000947565b620002807f000000000000000000000000000000000000000000000000000000000000000081565b6200028060008051602062003edb83398151915281565b62000231620002f636600462002153565b62000975565b620002316200030d366004620020d5565b62000d24565b6200033b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200162000211565b6003546200033b906201000090046001600160a01b031681565b620002056200037f366004620021ce565b62000da6565b6200020562000db5565b6200033b7f000000000000000000000000000000000000000000000000000000000000000081565b62000231620003c8366004620021ce565b62000ff4565b62000231620003df366004620020bb565b6200101a565b62000205620003f6366004620020d5565b620010dc565b6200028060045481565b62000280600081565b6200023162000420366004620021ce565b62001105565b6003546200020590610100900460ff1681565b620002316200044a366004620020d5565b6200112b565b6200023162001154565b620002807f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec81565b620002807f8cd858bfd7aa18f854ced20f5efaa6788369a3c155ff57005c502a77a8369f0e81565b62000231620011e9565b62000231620004c53660046200203f565b6200129f565b60006001600160e01b03198216637965db0b60e01b1480620004fd57506301ffc9a760e01b6001600160e01b03198316145b92915050565b816200051160018262001335565b620005395760405162461bcd60e51b81526004016200053090620021ec565b60405180910390fd5b60035460ff166200058d5760405162461bcd60e51b815260206004820152601f60248201527f4f5443436f6e74726f6c6c65723a2053616c65732061726520636c6f73656400604482015260640162000530565b81600003620005df5760405162461bcd60e51b815260206004820152601d60248201527f4f5443436f6e74726f6c6c65723a20616d6f756e74206973207a65726f000000604482015260640162000530565b600454600003620006335760405162461bcd60e51b815260206004820152601c60248201527f4f5443436f6e74726f6c6c65723a207072696365206973207a65726f00000000604482015260640162000530565b826000620006637f0000000000000000000000000000000000000000000000000000000000000000600262002246565b6200067090600a6200235d565b826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620006af573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006d591906200236b565b620006e290600a62002390565b85600454620006f2919062002246565b620006fe919062002246565b6200070a9190620023a1565b9050620007236001600160a01b03831633308462001371565b60007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620007a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007cb91906200236b565b60ff16620007da9190620023c4565b620007e790600a6200235d565b620007f3908662002246565b6003549091506200085b906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116917f00000000000000000000000000000000000000000000000000000000000000009162010000909104168462001371565b6003546201000090046001600160a01b03168063799d97fa336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401600060405180830381600087803b158015620008bd57600080fd5b505af1158015620008d2573d6000803e3d6000fd5b50505050866001600160a01b0316620008e83390565b6001600160a01b03167ff3ecb4dab83f41da3035ff9cb3a2ef0c3027ebb89ae4e4b822d7c109e869a2fc846040516200092391815260200190565b60405180910390a350505050505050565b6060620009426001620013e4565b905090565b6000828152602081905260409020600101546200096481620013f3565b620009708383620013ff565b505050565b7f8cd858bfd7aa18f854ced20f5efaa6788369a3c155ff57005c502a77a8369f0e620009a181620013f3565b604051636eb1769f60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301523060248301526000917f00000000000000000000000000000000000000000000000000000000000000009091169063dd62ed3e90604401602060405180830381865afa15801562000a33573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a599190620023da565b1162000aba5760405162461bcd60e51b815260206004820152602960248201527f4f5443436f6e74726f6c6c65723a20436f6e74726f6c6c6572206e6565647320604482015268616c6c6f77616e636560b81b606482015260840162000530565b60035460ff161562000b1f5760405162461bcd60e51b815260206004820152602760248201527f4f5443436f6e74726f6c6c65723a2053616c65732061726520616c7265616479604482015266081bdc195b995960ca1b606482015260840162000530565b600354610100900460ff161562000b8b5760405162461bcd60e51b815260206004820152602960248201527f4f5443436f6e74726f6c6c65723a20556e61626c6520746f206f70656e2073616044820152683632b99030b3b0b4b760b91b606482015260840162000530565b60006004541162000beb5760405162461bcd60e51b8152602060048201526024808201527f4f5443436f6e74726f6c6c65723a205072696365206973206e6f74206173736960448201526319db995960e21b606482015260840162000530565b600062000bf9600162001487565b1162000c545760405162461bcd60e51b815260206004820152602360248201527f4f5443436f6e74726f6c6c65723a20537461626c65636f696e206e6f7420616460448201526219195960ea1b606482015260840162000530565b60007f0000000000000000000000000000000000000000000000000000000000000000878787878760405162000c8a9062001fe8565b62000c9b969594939291906200243f565b604051809103906000f08015801562000cb8573d6000803e3d6000fd5b506003805461ff001960ff196001600160a01b03851662010000021661ff01600160b01b031990921691909117600117166101001790556040519091507fcb2d1afee08f05a64e0c510df45b66e43153ca6d0b90429bfdda12f05aa43b8090600090a150505050505050565b6001600160a01b038116331462000d965760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840162000530565b62000da2828262001492565b5050565b6000620004fd60018362001335565b6000807f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000e38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e5e91906200236b565b60ff1662000e6d9190620023c4565b62000e7a90600a6200235d565b6040516370a0823160e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015291925082917f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa15801562000f06573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f2c9190620023da565b11801562000fee5750604051636eb1769f60e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116600483015230602483015282917f00000000000000000000000000000000000000000000000000000000000000009091169063dd62ed3e90604401602060405180830381865afa15801562000fc6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000fec9190620023da565b115b91505090565b60008051602062003edb8339815191526200100f81620013f3565b62000da282620014fa565b60008051602062003edb8339815191526200103581620013f3565b600082116200109e5760405162461bcd60e51b815260206004820152602e60248201527f4f5443436f6e74726f6c6c65723a205072696365204d5553542062652067726560448201526d61746572207468616e207a65726f60901b606482015260840162000530565b600482905560405182815233907ff91787331ab1c521b66ab594ed9857aaf11252b6881b0143cae876a522446bb59060200160405180910390a25050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602062003edb8339815191526200112081620013f3565b62000da282620015ef565b6000828152602081905260409020600101546200114881620013f3565b62000970838362001492565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec6200118081620013f3565b6200118c6001620016d2565b620011e65760405162461bcd60e51b815260206004820152602360248201527f4f5443436f6e74726f6c6c65723a204e6f2062616c616e636520617661696c61604482015262626c6560e81b606482015260840162000530565b50565b7f8cd858bfd7aa18f854ced20f5efaa6788369a3c155ff57005c502a77a8369f0e6200121581620013f3565b60035460ff16620012695760405162461bcd60e51b815260206004820152601f60248201527f4f5443436f6e74726f6c6c65723a2053616c65732061726520636c6f73656400604482015260640162000530565b6003805460ff191690556040517f4c013bd73202fde3c7cfe26ca486d0882f2c5b2fc9c761b15212f759bd2347dd90600090a150565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec620012cb81620013f3565b60008211620013295760405162461bcd60e51b8152602060048201526024808201527f4f5443436f6e74726f6c6c65723a20416d6f756e742063616e6e6f74206265206044820152637a65726f60e01b606482015260840162000530565b62000970838362001797565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b600062001353836001600160a01b038416620017f3565b6040516001600160a01b0380851660248301528316604482015260648101829052620013de9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262001845565b50505050565b60606000620013538362001921565b620011e681336200197f565b6200140b8282620010dc565b62000da2576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620014433390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620004fd825490565b6200149e8282620010dc565b1562000da2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f0000000000000000000000000000000000000000000000000000000000000000816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200155a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200158091906200236b565b60ff161015620015e45760405162461bcd60e51b815260206004820152602860248201527f4f5443436f6e74726f6c6c65723a2043757272656e637920646563696d616c7360448201526720746f6f206c6f7760c01b606482015260840162000530565b620011e681620019e3565b80620015fd60018262001335565b6200161c5760405162461bcd60e51b81526004016200053090620021ec565b60016200162a600162001487565b116200168c5760405162461bcd60e51b815260206004820152602a60248201527f474f4256616c696443757272656e636965733a204f6e6c79206f6e65206375726044820152691c995b98de481b19599d60b21b606482015260840162000530565b6200169960018362001af0565b506040516001600160a01b038316907fa40d69111be14f29022626d38310e47cc2d7f4cb728961509c2f65a4bee08c5b90600090a25050565b6000806000620016e28462001487565b90506000805b828110156200178e57620016fd868262001b07565b6040516370a0823160e01b81523060048201529092506001600160a01b038316906370a0823190602401602060405180830381865afa15801562001745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200176b9190620023da565b93508315620017855762001780828562001797565b600194505b600101620016e8565b50505050919050565b81620017ae6001600160a01b038216338462001b15565b6040518281526001600160a01b0384169033907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a3505050565b60008181526001830160205260408120546200183c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620004fd565b506000620004fd565b60006200189c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662001b479092919063ffffffff16565b9050805160001480620018c0575080806020019051810190620018c091906200248f565b620009705760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000530565b6060816000018054806020026020016040519081016040528092919081815260200182805480156200197357602002820191906000526020600020905b8154815260200190600101908083116200195e575b50505050509050919050565b6200198b8282620010dc565b62000da2576200199b8162001b60565b620019a883602062001b73565b604051602001620019bb929190620024d9565b60408051601f198184030181529082905262461bcd60e51b8252620005309160040162002552565b6001600160a01b03811662001a3b5760405162461bcd60e51b815260206004820181905260248201527f474f4256616c696443757272656e636965733a205a65726f2061646472657373604482015260640162000530565b62001a4860018262001335565b1562001aab5760405162461bcd60e51b815260206004820152602b60248201527f474f4256616c696443757272656e636965733a2043757272656e637920616c7260448201526a656164792065786973747360a81b606482015260840162000530565b62001ab86001826200135a565b506040516001600160a01b038216907fe0390a89516146ccfb796a9fbfc3f7646282194c554d05020484599ee992dd5a90600090a250565b600062001353836001600160a01b03841662001d2d565b600062001353838362001e31565b6040516001600160a01b0383166024820152604481018290526200097090849063a9059cbb60e01b90606401620013a6565b606062001b58848460008562001e5e565b949350505050565b6060620004fd6001600160a01b03831660145b6060600062001b8483600262002246565b62001b9190600262002587565b67ffffffffffffffff81111562001bac5762001bac6200259d565b6040519080825280601f01601f19166020018201604052801562001bd7576020820181803683370190505b509050600360fc1b8160008151811062001bf55762001bf5620025b3565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811062001c275762001c27620025b3565b60200101906001600160f81b031916908160001a905350600062001c4d84600262002246565b62001c5a90600162002587565b90505b600181111562001cdc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811062001c925762001c92620025b3565b1a60f81b82828151811062001cab5762001cab620025b3565b60200101906001600160f81b031916908160001a90535060049490941c9362001cd481620025c9565b905062001c5d565b508315620013535760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000530565b6000818152600183016020526040812054801562001e2657600062001d54600183620023c4565b855490915060009062001d6a90600190620023c4565b905081811462001dd657600086600001828154811062001d8e5762001d8e620025b3565b906000526020600020015490508087600001848154811062001db45762001db4620025b3565b6000918252602080832090910192909255918252600188019052604090208390555b855486908062001dea5762001dea620025e3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050620004fd565b6000915050620004fd565b600082600001828154811062001e4b5762001e4b620025b3565b9060005260206000200154905092915050565b60608247101562001ec15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000530565b600080866001600160a01b0316858760405162001edf9190620025f9565b60006040518083038185875af1925050503d806000811462001f1e576040519150601f19603f3d011682016040523d82523d6000602084013e62001f23565b606091505b509150915062001f368783838762001f41565b979650505050505050565b6060831562001fb557825160000362001fad576001600160a01b0385163b62001fad5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000530565b508162001b58565b62001b58838381511562001fcc5781518083602001fd5b8060405162461bcd60e51b815260040162000530919062002552565b6118c3806200261883390190565b6000602082840312156200200957600080fd5b81356001600160e01b0319811681146200135357600080fd5b80356001600160a01b03811681146200203a57600080fd5b919050565b600080604083850312156200205357600080fd5b6200205e8362002022565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015620020af5783516001600160a01b03168352928401929184019160010162002088565b50909695505050505050565b600060208284031215620020ce57600080fd5b5035919050565b60008060408385031215620020e957600080fd5b82359150620020fb6020840162002022565b90509250929050565b60008083601f8401126200211757600080fd5b50813567ffffffffffffffff8111156200213057600080fd5b6020830191508360208260051b85010111156200214c57600080fd5b9250929050565b6000806000806000606086880312156200216c57600080fd5b853567ffffffffffffffff808211156200218557600080fd5b6200219389838a0162002104565b90975095506020880135915080821115620021ad57600080fd5b50620021bc8882890162002104565b96999598509660400135949350505050565b600060208284031215620021e157600080fd5b620013538262002022565b60208082526024908201527f474f4256616c696443757272656e636965733a20496e76616c69642063757272604082015263656e637960e01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417620004fd57620004fd62002230565b600181815b80851115620022a157816000190482111562002285576200228562002230565b808516156200229357918102915b93841c939080029062002265565b509250929050565b600082620022ba57506001620004fd565b81620022c957506000620004fd565b8160018114620022e25760028114620022ed576200230d565b6001915050620004fd565b60ff84111562002301576200230162002230565b50506001821b620004fd565b5060208310610133831016604e8410600b841016171562002332575081810a620004fd565b6200233e838362002260565b806000190482111562002355576200235562002230565b029392505050565b6000620013538383620022a9565b6000602082840312156200237e57600080fd5b815160ff811681146200135357600080fd5b60006200135360ff841683620022a9565b600082620023bf57634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115620004fd57620004fd62002230565b600060208284031215620023ed57600080fd5b5051919050565b8183526000602080850194508260005b8581101562002434576001600160a01b03620024208362002022565b168752958201959082019060010162002404565b509495945050505050565b6001600160a01b0387168152608060208201819052600090620024669083018789620023f4565b82810360408401526200247b818688620023f4565b915050826060830152979650505050505050565b600060208284031215620024a257600080fd5b815180151581146200135357600080fd5b60005b83811015620024d0578181015183820152602001620024b6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835162002513816017850160208801620024b3565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835162002546816028840160208801620024b3565b01602801949350505050565b602081526000825180602084015262002573816040850160208701620024b3565b601f01601f19169190910160400192915050565b80820180821115620004fd57620004fd62002230565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081620025db57620025db62002230565b506000190190565b634e487b7160e01b600052603160045260246000fd5b600082516200260d818460208701620024b3565b919091019291505056fe60e06040523480156200001157600080fd5b50604051620018c3380380620018c383398101604081905262000034916200036c565b8251600003620000965760405162461bcd60e51b8152602060048201526024808201527f56657374696e673a20696e697469616c417574686f72697a65727320697320656044820152636d70747960e01b606482015260840160405180910390fd5b620000c060008051602062001883833981519152600080516020620018a3833981519152620001a0565b620000ec7f3f5a532227b9b08a3b33c93161a35605c0395059b70f07b7f4ce3d0165205ed633620001eb565b3360c0526001600160a01b03841660805260a081905260005b825181101562000155576200014c60008051602062001883833981519152848381518110620001385762000138620003f1565b6020026020010151620001eb60201b60201c565b60010162000105565b5060005b835181101562000195576200018c600080516020620018a3833981519152858381518110620001385762000138620003f1565b60010162000159565b505050505062000407565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000288576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b0381168114620002a457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002d157600080fd5b815160206001600160401b0380831115620002f057620002f0620002a9565b8260051b604051601f19603f83011681018181108482111715620003185762000318620002a9565b6040529384528581018301938381019250878511156200033757600080fd5b83870191505b84821015620003615762000351826200028c565b835291830191908301906200033d565b979650505050505050565b600080600080608085870312156200038357600080fd5b6200038e856200028c565b60208601519094506001600160401b0380821115620003ac57600080fd5b620003ba88838901620002bf565b94506040870151915080821115620003d157600080fd5b50620003e087828801620002bf565b606096909601519497939650505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c0516114376200044c6000396000610302015260008181610254015261065d0152600081816103410152818161046601526108b701526114376000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c806396ffeca2116100ad578063d547741f11610071578063d547741f146102b0578063d8fb9337146102c3578063ef97aa21146102d6578063f77c4791146102fd578063fc0c546a1461033c57600080fd5b806396ffeca21461022d578063a217fddf14610247578063a36621bb1461024f578063b13e4a9d14610276578063bc06946f1461028957600080fd5b806358cb5a2d116100f457806358cb5a2d146101ba57806370a08231146101e1578063799d97fa146101f457806391d14854146102075780639470b0bd1461021a57600080fd5b806301ffc9a714610131578063248a9ca3146101595780632f2ff15d1461018a57806336568abe1461019f5780633ccfd60b146101b2575b600080fd5b61014461013f366004611178565b610363565b60405190151581526020015b60405180910390f35b61017c6101673660046111a2565b60009081526020819052604090206001015490565b604051908152602001610150565b61019d6101983660046111d7565b61039a565b005b61019d6101ad3660046111d7565b6103c4565b61019d610447565b61017c7f3f5a532227b9b08a3b33c93161a35605c0395059b70f07b7f4ce3d0165205ed681565b61017c6101ef366004611203565b6104d1565b61019d61020236600461121e565b6104e5565b6101446102153660046111d7565b61074b565b61019d61022836600461121e565b610774565b61023560ff81565b60405160ff9091168152602001610150565b61017c600081565b61017c7f000000000000000000000000000000000000000000000000000000000000000081565b61017c610284366004611203565b610931565b61017c7f14dd327f3834be9d0f7cf44f6cf11c96ded83bd68d1a1b3926d35739e7bb88d081565b61019d6102be3660046111d7565b610945565b61017c6102d1366004611203565b61096a565b61017c7fb0e3ae34a3ebd864ed280a15abe71cbcaf59103e086737862f5bbccae6a44b3781565b6103247f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610150565b6103247f000000000000000000000000000000000000000000000000000000000000000081565b60006001600160e01b03198216637965db0b60e01b148061039457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152602081905260409020600101546103b581610987565b6103bf8383610994565b505050565b6001600160a01b03811633146104395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104438282610a18565b5050565b3360006104578260001983610a7d565b905061048d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383610c4b565b6040518181526001600160a01b0383169081907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a35050565b6000806104dd83610c9d565b509392505050565b7f3f5a532227b9b08a3b33c93161a35605c0395059b70f07b7f4ce3d0165205ed661050f81610987565b6001600160a01b0383166105765760405162461bcd60e51b815260206004820152602860248201527f56657374696e673a2062656e656669636961727920697320746865207a65726f604482015267206164647265737360c01b6064820152608401610430565b816000036105c05760405162461bcd60e51b815260206004820152601760248201527656657374696e673a20616d6f756e74206973207a65726f60481b6044820152606401610430565b6001600160a01b03831660009081526001602090815260408083205460029092529091205460ff906105f2908361125e565b11156106555760405162461bcd60e51b815260206004820152602c60248201527f56657374696e673a204d6178206167656e646173207265616368656420666f7260448201526b2062656e656669636961727960a01b6064820152608401610430565b4260006106827f000000000000000000000000000000000000000000000000000000000000000083611271565b604080518082019091528681526020810182905290915060006106a58886610d2b565b6001600160a01b03891660009081526001602052604081208054929350906106cc83611284565b909155505060008181526003602090815260409182902084518155848201516001909101558151898152908101839052908101859052606081018490526001600160a01b038916907f66f939753fe55ed8e71143b010d554a70be0aad4fbdd8dd149ea81cd63a0be259060800160405180910390a25050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b7fb0e3ae34a3ebd864ed280a15abe71cbcaf59103e086737862f5bbccae6a44b3761079e81610987565b600082116107e85760405162461bcd60e51b815260206004820152601760248201527656657374696e673a20616d6f756e74206973207a65726f60481b6044820152606401610430565b6001600160a01b03831661084f5760405162461bcd60e51b815260206004820152602860248201527f56657374696e673a206167656e64614f776e657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401610430565b338261085d85826001610a7d565b146108aa5760405162461bcd60e51b815260206004820152601f60248201527f56657374696e673a20616d6f756e7420657863656564732062616c616e6365006044820152606401610430565b6108de6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168285610c4b565b806001600160a01b0316846001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb8560405161092391815260200190565b60405180910390a350505050565b60008061093d83610c9d565b949350505050565b60008281526020819052604090206001015461096081610987565b6103bf8383610a18565b600080600061097884610c9d565b909250905061093d828261125e565b6109918133610d72565b50565b61099e828261074b565b610443576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556109d43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610a22828261074b565b15610443576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038316600090815260016020908152604080832054600290925282205442815b83811015610bf0578615610bf0576000610abe8983610d2b565b60008181526003602052604081206001810154929350919003610ae2575050610bde565b87158015610af35750806001015484105b15610aff575050610bde565b80548911610b7e5788816000016000828254610b1b919061125e565b90915550610b2b90508988611271565b815460009a509097508903610b79576001600160a01b038a166000908152600260205260408120805491610b5e83611284565b90915550506000828152600360205260408120818155600101555b610bdb565b8054610b8a908a61125e565b8154909950610b999088611271565b6001600160a01b038b166000908152600260205260408120805492995090610bc083611284565b90915550506000828152600360205260408120818155600101555b50505b80610be881611284565b915050610aa4565b5060008411610c415760405162461bcd60e51b815260206004820152601860248201527f56657374696e673a2062616c616e6365206973207a65726f00000000000000006044820152606401610430565b5050509392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526103bf908490610dcb565b6001600160a01b038116600090815260016020908152604080832054600290925282205482919042815b83811015610d22576000610cdb8883610d2b565b60008181526003602052604090206001810154919250908410610d07578054610d049089611271565b97505b8054610d139088611271565b96508260010192505050610cc7565b50505050915091565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b610d7c828261074b565b61044357610d8981610ea0565b610d94836020610eb2565b604051602001610da59291906112c1565b60408051601f198184030181529082905262461bcd60e51b825261043091600401611336565b6000610e20826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110559092919063ffffffff16565b9050805160001480610e41575080806020019051810190610e419190611369565b6103bf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610430565b60606103946001600160a01b03831660145b60606000610ec183600261138b565b610ecc906002611271565b67ffffffffffffffff811115610ee457610ee46113a2565b6040519080825280601f01601f191660200182016040528015610f0e576020820181803683370190505b509050600360fc1b81600081518110610f2957610f296113b8565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610f5857610f586113b8565b60200101906001600160f81b031916908160001a9053506000610f7c84600261138b565b610f87906001611271565b90505b6001811115610fff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610fbb57610fbb6113b8565b1a60f81b828281518110610fd157610fd16113b8565b60200101906001600160f81b031916908160001a90535060049490941c93610ff8816113ce565b9050610f8a565b50831561104e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610430565b9392505050565b606061093d848460008585600080866001600160a01b0316858760405161107c91906113e5565b60006040518083038185875af1925050503d80600081146110b9576040519150601f19603f3d011682016040523d82523d6000602084013e6110be565b606091505b50915091506110cf878383876110da565b979650505050505050565b60608315611149578251600003611142576001600160a01b0385163b6111425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610430565b508161093d565b61093d838381511561115e5781518083602001fd5b8060405162461bcd60e51b81526004016104309190611336565b60006020828403121561118a57600080fd5b81356001600160e01b03198116811461104e57600080fd5b6000602082840312156111b457600080fd5b5035919050565b80356001600160a01b03811681146111d257600080fd5b919050565b600080604083850312156111ea57600080fd5b823591506111fa602084016111bb565b90509250929050565b60006020828403121561121557600080fd5b61104e826111bb565b6000806040838503121561123157600080fd5b61123a836111bb565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561039457610394611248565b8082018082111561039457610394611248565b60006001820161129657611296611248565b5060010190565b60005b838110156112b85781810151838201526020016112a0565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516112f981601785016020880161129d565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161132a81602884016020880161129d565b01602801949350505050565b602081526000825180602084015261135581604085016020870161129d565b601f01601f19169190910160400192915050565b60006020828403121561137b57600080fd5b8151801515811461104e57600080fd5b808202811582820484141761039457610394611248565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816113dd576113dd611248565b506000190190565b600082516113f781846020870161129d565b919091019291505056fea2646970667358221220a8d8aa88e2bcdb725f9db2953cb005acf9ecd65799e096114aa89719e515c6fa64736f6c63430008120033b0e3ae34a3ebd864ed280a15abe71cbcaf59103e086737862f5bbccae6a44b3714dd327f3834be9d0f7cf44f6cf11c96ded83bd68d1a1b3926d35739e7bb88d03515f38d031dcbca5f1dac4c5afc1efca2020e42efdd9c5806ae7e963d18435aa2646970667358221220994601046370c45cada03086fe44956e8eb7e5ff2660d5bfbd98ca98d68b578b64736f6c6343000812003300000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad200000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e004610000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
Deployed Bytecode
0x60806040523480156200001157600080fd5b5060043610620001e95760003560e01c806371b2cc3b116200010d578063cac4711011620000a3578063e02023a1116200007a578063e02023a1146200045a578063e0b68c121462000482578063ee55efee14620004aa578063f3fef3a314620004b457600080fd5b8063cac471101462000426578063d547741f1462000439578063e00ed8e8146200045057600080fd5b806391d1485411620000e457806391d1485414620003e5578063a035b1fe14620003fc578063a217fddf1462000406578063c5d3a107146200040f57600080fd5b806371b2cc3b146200038f5780638ab234b614620003b757806391b7f5ed14620003ce57600080fd5b806331aab75911620001835780633c4b40b8116200015a5780633c4b40b8146200031357806344c63eec14620003545780634fb92558146200036e578063537d22bd146200038557600080fd5b806331aab75914620002ce57806335eb618a14620002e557806336568abe14620002fc57600080fd5b80631d28031f11620001c45780631d28031f1462000241578063248a9ca3146200025a5780632f2ff15d146200028f578063313ce56714620002a657600080fd5b806301ffc9a714620001ee5780630752881a146200021a5780631a0813301462000233575b600080fd5b62000205620001ff36600462001ff6565b620004cb565b60405190151581526020015b60405180910390f35b620002316200022b3660046200203f565b62000503565b005b600354620002059060ff1681565b6200024b62000934565b6040516200021191906200206c565b620002806200026b366004620020bb565b60009081526020819052604090206001015490565b60405190815260200162000211565b62000231620002a0366004620020d5565b62000947565b620002807f000000000000000000000000000000000000000000000000000000000000000481565b6200028060008051602062003edb83398151915281565b62000231620002f636600462002153565b62000975565b620002316200030d366004620020d5565b62000d24565b6200033b7f000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad281565b6040516001600160a01b03909116815260200162000211565b6003546200033b906201000090046001600160a01b031681565b620002056200037f366004620021ce565b62000da6565b6200020562000db5565b6200033b7f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e0046181565b62000231620003c8366004620021ce565b62000ff4565b62000231620003df366004620020bb565b6200101a565b62000205620003f6366004620020d5565b620010dc565b6200028060045481565b62000280600081565b6200023162000420366004620021ce565b62001105565b6003546200020590610100900460ff1681565b620002316200044a366004620020d5565b6200112b565b6200023162001154565b620002807f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec81565b620002807f8cd858bfd7aa18f854ced20f5efaa6788369a3c155ff57005c502a77a8369f0e81565b62000231620011e9565b62000231620004c53660046200203f565b6200129f565b60006001600160e01b03198216637965db0b60e01b1480620004fd57506301ffc9a760e01b6001600160e01b03198316145b92915050565b816200051160018262001335565b620005395760405162461bcd60e51b81526004016200053090620021ec565b60405180910390fd5b60035460ff166200058d5760405162461bcd60e51b815260206004820152601f60248201527f4f5443436f6e74726f6c6c65723a2053616c65732061726520636c6f73656400604482015260640162000530565b81600003620005df5760405162461bcd60e51b815260206004820152601d60248201527f4f5443436f6e74726f6c6c65723a20616d6f756e74206973207a65726f000000604482015260640162000530565b600454600003620006335760405162461bcd60e51b815260206004820152601c60248201527f4f5443436f6e74726f6c6c65723a207072696365206973207a65726f00000000604482015260640162000530565b826000620006637f0000000000000000000000000000000000000000000000000000000000000004600262002246565b6200067090600a6200235d565b826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620006af573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006d591906200236b565b620006e290600a62002390565b85600454620006f2919062002246565b620006fe919062002246565b6200070a9190620023a1565b9050620007236001600160a01b03831633308462001371565b60007f00000000000000000000000000000000000000000000000000000000000000047f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e004616001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620007a5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007cb91906200236b565b60ff16620007da9190620023c4565b620007e790600a6200235d565b620007f3908662002246565b6003549091506200085b906001600160a01b037f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e004618116917f000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad29162010000909104168462001371565b6003546201000090046001600160a01b03168063799d97fa336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101859052604401600060405180830381600087803b158015620008bd57600080fd5b505af1158015620008d2573d6000803e3d6000fd5b50505050866001600160a01b0316620008e83390565b6001600160a01b03167ff3ecb4dab83f41da3035ff9cb3a2ef0c3027ebb89ae4e4b822d7c109e869a2fc846040516200092391815260200190565b60405180910390a350505050505050565b6060620009426001620013e4565b905090565b6000828152602081905260409020600101546200096481620013f3565b620009708383620013ff565b505050565b7f8cd858bfd7aa18f854ced20f5efaa6788369a3c155ff57005c502a77a8369f0e620009a181620013f3565b604051636eb1769f60e11b81526001600160a01b037f000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad2811660048301523060248301526000917f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e004619091169063dd62ed3e90604401602060405180830381865afa15801562000a33573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a599190620023da565b1162000aba5760405162461bcd60e51b815260206004820152602960248201527f4f5443436f6e74726f6c6c65723a20436f6e74726f6c6c6572206e6565647320604482015268616c6c6f77616e636560b81b606482015260840162000530565b60035460ff161562000b1f5760405162461bcd60e51b815260206004820152602760248201527f4f5443436f6e74726f6c6c65723a2053616c65732061726520616c7265616479604482015266081bdc195b995960ca1b606482015260840162000530565b600354610100900460ff161562000b8b5760405162461bcd60e51b815260206004820152602960248201527f4f5443436f6e74726f6c6c65723a20556e61626c6520746f206f70656e2073616044820152683632b99030b3b0b4b760b91b606482015260840162000530565b60006004541162000beb5760405162461bcd60e51b8152602060048201526024808201527f4f5443436f6e74726f6c6c65723a205072696365206973206e6f74206173736960448201526319db995960e21b606482015260840162000530565b600062000bf9600162001487565b1162000c545760405162461bcd60e51b815260206004820152602360248201527f4f5443436f6e74726f6c6c65723a20537461626c65636f696e206e6f7420616460448201526219195960ea1b606482015260840162000530565b60007f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e00461878787878760405162000c8a9062001fe8565b62000c9b969594939291906200243f565b604051809103906000f08015801562000cb8573d6000803e3d6000fd5b506003805461ff001960ff196001600160a01b03851662010000021661ff01600160b01b031990921691909117600117166101001790556040519091507fcb2d1afee08f05a64e0c510df45b66e43153ca6d0b90429bfdda12f05aa43b8090600090a150505050505050565b6001600160a01b038116331462000d965760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b606482015260840162000530565b62000da2828262001492565b5050565b6000620004fd60018362001335565b6000807f00000000000000000000000000000000000000000000000000000000000000047f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e004616001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000e38573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e5e91906200236b565b60ff1662000e6d9190620023c4565b62000e7a90600a6200235d565b6040516370a0823160e01b81526001600160a01b037f000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad28116600483015291925082917f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e0046116906370a0823190602401602060405180830381865afa15801562000f06573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f2c9190620023da565b11801562000fee5750604051636eb1769f60e11b81526001600160a01b037f000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad28116600483015230602483015282917f00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e004619091169063dd62ed3e90604401602060405180830381865afa15801562000fc6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000fec9190620023da565b115b91505090565b60008051602062003edb8339815191526200100f81620013f3565b62000da282620014fa565b60008051602062003edb8339815191526200103581620013f3565b600082116200109e5760405162461bcd60e51b815260206004820152602e60248201527f4f5443436f6e74726f6c6c65723a205072696365204d5553542062652067726560448201526d61746572207468616e207a65726f60901b606482015260840162000530565b600482905560405182815233907ff91787331ab1c521b66ab594ed9857aaf11252b6881b0143cae876a522446bb59060200160405180910390a25050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b60008051602062003edb8339815191526200112081620013f3565b62000da282620015ef565b6000828152602081905260409020600101546200114881620013f3565b62000970838362001492565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec6200118081620013f3565b6200118c6001620016d2565b620011e65760405162461bcd60e51b815260206004820152602360248201527f4f5443436f6e74726f6c6c65723a204e6f2062616c616e636520617661696c61604482015262626c6560e81b606482015260840162000530565b50565b7f8cd858bfd7aa18f854ced20f5efaa6788369a3c155ff57005c502a77a8369f0e6200121581620013f3565b60035460ff16620012695760405162461bcd60e51b815260206004820152601f60248201527f4f5443436f6e74726f6c6c65723a2053616c65732061726520636c6f73656400604482015260640162000530565b6003805460ff191690556040517f4c013bd73202fde3c7cfe26ca486d0882f2c5b2fc9c761b15212f759bd2347dd90600090a150565b7f5d8e12c39142ff96d79d04d15d1ba1269e4fe57bb9d26f43523628b34ba108ec620012cb81620013f3565b60008211620013295760405162461bcd60e51b8152602060048201526024808201527f4f5443436f6e74726f6c6c65723a20416d6f756e742063616e6e6f74206265206044820152637a65726f60e01b606482015260840162000530565b62000970838362001797565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b600062001353836001600160a01b038416620017f3565b6040516001600160a01b0380851660248301528316604482015260648101829052620013de9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262001845565b50505050565b60606000620013538362001921565b620011e681336200197f565b6200140b8282620010dc565b62000da2576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620014433390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000620004fd825490565b6200149e8282620010dc565b1562000da2576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f0000000000000000000000000000000000000000000000000000000000000004816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200155a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200158091906200236b565b60ff161015620015e45760405162461bcd60e51b815260206004820152602860248201527f4f5443436f6e74726f6c6c65723a2043757272656e637920646563696d616c7360448201526720746f6f206c6f7760c01b606482015260840162000530565b620011e681620019e3565b80620015fd60018262001335565b6200161c5760405162461bcd60e51b81526004016200053090620021ec565b60016200162a600162001487565b116200168c5760405162461bcd60e51b815260206004820152602a60248201527f474f4256616c696443757272656e636965733a204f6e6c79206f6e65206375726044820152691c995b98de481b19599d60b21b606482015260840162000530565b6200169960018362001af0565b506040516001600160a01b038316907fa40d69111be14f29022626d38310e47cc2d7f4cb728961509c2f65a4bee08c5b90600090a25050565b6000806000620016e28462001487565b90506000805b828110156200178e57620016fd868262001b07565b6040516370a0823160e01b81523060048201529092506001600160a01b038316906370a0823190602401602060405180830381865afa15801562001745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200176b9190620023da565b93508315620017855762001780828562001797565b600194505b600101620016e8565b50505050919050565b81620017ae6001600160a01b038216338462001b15565b6040518281526001600160a01b0384169033907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a3505050565b60008181526001830160205260408120546200183c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155620004fd565b506000620004fd565b60006200189c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662001b479092919063ffffffff16565b9050805160001480620018c0575080806020019051810190620018c091906200248f565b620009705760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840162000530565b6060816000018054806020026020016040519081016040528092919081815260200182805480156200197357602002820191906000526020600020905b8154815260200190600101908083116200195e575b50505050509050919050565b6200198b8282620010dc565b62000da2576200199b8162001b60565b620019a883602062001b73565b604051602001620019bb929190620024d9565b60408051601f198184030181529082905262461bcd60e51b8252620005309160040162002552565b6001600160a01b03811662001a3b5760405162461bcd60e51b815260206004820181905260248201527f474f4256616c696443757272656e636965733a205a65726f2061646472657373604482015260640162000530565b62001a4860018262001335565b1562001aab5760405162461bcd60e51b815260206004820152602b60248201527f474f4256616c696443757272656e636965733a2043757272656e637920616c7260448201526a656164792065786973747360a81b606482015260840162000530565b62001ab86001826200135a565b506040516001600160a01b038216907fe0390a89516146ccfb796a9fbfc3f7646282194c554d05020484599ee992dd5a90600090a250565b600062001353836001600160a01b03841662001d2d565b600062001353838362001e31565b6040516001600160a01b0383166024820152604481018290526200097090849063a9059cbb60e01b90606401620013a6565b606062001b58848460008562001e5e565b949350505050565b6060620004fd6001600160a01b03831660145b6060600062001b8483600262002246565b62001b9190600262002587565b67ffffffffffffffff81111562001bac5762001bac6200259d565b6040519080825280601f01601f19166020018201604052801562001bd7576020820181803683370190505b509050600360fc1b8160008151811062001bf55762001bf5620025b3565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811062001c275762001c27620025b3565b60200101906001600160f81b031916908160001a905350600062001c4d84600262002246565b62001c5a90600162002587565b90505b600181111562001cdc576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811062001c925762001c92620025b3565b1a60f81b82828151811062001cab5762001cab620025b3565b60200101906001600160f81b031916908160001a90535060049490941c9362001cd481620025c9565b905062001c5d565b508315620013535760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640162000530565b6000818152600183016020526040812054801562001e2657600062001d54600183620023c4565b855490915060009062001d6a90600190620023c4565b905081811462001dd657600086600001828154811062001d8e5762001d8e620025b3565b906000526020600020015490508087600001848154811062001db45762001db4620025b3565b6000918252602080832090910192909255918252600188019052604090208390555b855486908062001dea5762001dea620025e3565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050620004fd565b6000915050620004fd565b600082600001828154811062001e4b5762001e4b620025b3565b9060005260206000200154905092915050565b60608247101562001ec15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840162000530565b600080866001600160a01b0316858760405162001edf9190620025f9565b60006040518083038185875af1925050503d806000811462001f1e576040519150601f19603f3d011682016040523d82523d6000602084013e62001f23565b606091505b509150915062001f368783838762001f41565b979650505050505050565b6060831562001fb557825160000362001fad576001600160a01b0385163b62001fad5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162000530565b508162001b58565b62001b58838381511562001fcc5781518083602001fd5b8060405162461bcd60e51b815260040162000530919062002552565b6118c3806200261883390190565b6000602082840312156200200957600080fd5b81356001600160e01b0319811681146200135357600080fd5b80356001600160a01b03811681146200203a57600080fd5b919050565b600080604083850312156200205357600080fd5b6200205e8362002022565b946020939093013593505050565b6020808252825182820181905260009190848201906040850190845b81811015620020af5783516001600160a01b03168352928401929184019160010162002088565b50909695505050505050565b600060208284031215620020ce57600080fd5b5035919050565b60008060408385031215620020e957600080fd5b82359150620020fb6020840162002022565b90509250929050565b60008083601f8401126200211757600080fd5b50813567ffffffffffffffff8111156200213057600080fd5b6020830191508360208260051b85010111156200214c57600080fd5b9250929050565b6000806000806000606086880312156200216c57600080fd5b853567ffffffffffffffff808211156200218557600080fd5b6200219389838a0162002104565b90975095506020880135915080821115620021ad57600080fd5b50620021bc8882890162002104565b96999598509660400135949350505050565b600060208284031215620021e157600080fd5b620013538262002022565b60208082526024908201527f474f4256616c696443757272656e636965733a20496e76616c69642063757272604082015263656e637960e01b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417620004fd57620004fd62002230565b600181815b80851115620022a157816000190482111562002285576200228562002230565b808516156200229357918102915b93841c939080029062002265565b509250929050565b600082620022ba57506001620004fd565b81620022c957506000620004fd565b8160018114620022e25760028114620022ed576200230d565b6001915050620004fd565b60ff84111562002301576200230162002230565b50506001821b620004fd565b5060208310610133831016604e8410600b841016171562002332575081810a620004fd565b6200233e838362002260565b806000190482111562002355576200235562002230565b029392505050565b6000620013538383620022a9565b6000602082840312156200237e57600080fd5b815160ff811681146200135357600080fd5b60006200135360ff841683620022a9565b600082620023bf57634e487b7160e01b600052601260045260246000fd5b500490565b81810381811115620004fd57620004fd62002230565b600060208284031215620023ed57600080fd5b5051919050565b8183526000602080850194508260005b8581101562002434576001600160a01b03620024208362002022565b168752958201959082019060010162002404565b509495945050505050565b6001600160a01b0387168152608060208201819052600090620024669083018789620023f4565b82810360408401526200247b818688620023f4565b915050826060830152979650505050505050565b600060208284031215620024a257600080fd5b815180151581146200135357600080fd5b60005b83811015620024d0578181015183820152602001620024b6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835162002513816017850160208801620024b3565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835162002546816028840160208801620024b3565b01602801949350505050565b602081526000825180602084015262002573816040850160208701620024b3565b601f01601f19169190910160400192915050565b80820180821115620004fd57620004fd62002230565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081620025db57620025db62002230565b506000190190565b634e487b7160e01b600052603160045260246000fd5b600082516200260d818460208701620024b3565b919091019291505056fe60e06040523480156200001157600080fd5b50604051620018c3380380620018c383398101604081905262000034916200036c565b8251600003620000965760405162461bcd60e51b8152602060048201526024808201527f56657374696e673a20696e697469616c417574686f72697a65727320697320656044820152636d70747960e01b606482015260840160405180910390fd5b620000c060008051602062001883833981519152600080516020620018a3833981519152620001a0565b620000ec7f3f5a532227b9b08a3b33c93161a35605c0395059b70f07b7f4ce3d0165205ed633620001eb565b3360c0526001600160a01b03841660805260a081905260005b825181101562000155576200014c60008051602062001883833981519152848381518110620001385762000138620003f1565b6020026020010151620001eb60201b60201c565b60010162000105565b5060005b835181101562000195576200018c600080516020620018a3833981519152858381518110620001385762000138620003f1565b60010162000159565b505050505062000407565b600082815260208190526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000288576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620002473390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b0381168114620002a457600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002d157600080fd5b815160206001600160401b0380831115620002f057620002f0620002a9565b8260051b604051601f19603f83011681018181108482111715620003185762000318620002a9565b6040529384528581018301938381019250878511156200033757600080fd5b83870191505b84821015620003615762000351826200028c565b835291830191908301906200033d565b979650505050505050565b600080600080608085870312156200038357600080fd5b6200038e856200028c565b60208601519094506001600160401b0380821115620003ac57600080fd5b620003ba88838901620002bf565b94506040870151915080821115620003d157600080fd5b50620003e087828801620002bf565b606096909601519497939650505050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c0516114376200044c6000396000610302015260008181610254015261065d0152600081816103410152818161046601526108b701526114376000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c806396ffeca2116100ad578063d547741f11610071578063d547741f146102b0578063d8fb9337146102c3578063ef97aa21146102d6578063f77c4791146102fd578063fc0c546a1461033c57600080fd5b806396ffeca21461022d578063a217fddf14610247578063a36621bb1461024f578063b13e4a9d14610276578063bc06946f1461028957600080fd5b806358cb5a2d116100f457806358cb5a2d146101ba57806370a08231146101e1578063799d97fa146101f457806391d14854146102075780639470b0bd1461021a57600080fd5b806301ffc9a714610131578063248a9ca3146101595780632f2ff15d1461018a57806336568abe1461019f5780633ccfd60b146101b2575b600080fd5b61014461013f366004611178565b610363565b60405190151581526020015b60405180910390f35b61017c6101673660046111a2565b60009081526020819052604090206001015490565b604051908152602001610150565b61019d6101983660046111d7565b61039a565b005b61019d6101ad3660046111d7565b6103c4565b61019d610447565b61017c7f3f5a532227b9b08a3b33c93161a35605c0395059b70f07b7f4ce3d0165205ed681565b61017c6101ef366004611203565b6104d1565b61019d61020236600461121e565b6104e5565b6101446102153660046111d7565b61074b565b61019d61022836600461121e565b610774565b61023560ff81565b60405160ff9091168152602001610150565b61017c600081565b61017c7f000000000000000000000000000000000000000000000000000000000000000081565b61017c610284366004611203565b610931565b61017c7f14dd327f3834be9d0f7cf44f6cf11c96ded83bd68d1a1b3926d35739e7bb88d081565b61019d6102be3660046111d7565b610945565b61017c6102d1366004611203565b61096a565b61017c7fb0e3ae34a3ebd864ed280a15abe71cbcaf59103e086737862f5bbccae6a44b3781565b6103247f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610150565b6103247f000000000000000000000000000000000000000000000000000000000000000081565b60006001600160e01b03198216637965db0b60e01b148061039457506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152602081905260409020600101546103b581610987565b6103bf8383610994565b505050565b6001600160a01b03811633146104395760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b6104438282610a18565b5050565b3360006104578260001983610a7d565b905061048d6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168383610c4b565b6040518181526001600160a01b0383169081907fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb9060200160405180910390a35050565b6000806104dd83610c9d565b509392505050565b7f3f5a532227b9b08a3b33c93161a35605c0395059b70f07b7f4ce3d0165205ed661050f81610987565b6001600160a01b0383166105765760405162461bcd60e51b815260206004820152602860248201527f56657374696e673a2062656e656669636961727920697320746865207a65726f604482015267206164647265737360c01b6064820152608401610430565b816000036105c05760405162461bcd60e51b815260206004820152601760248201527656657374696e673a20616d6f756e74206973207a65726f60481b6044820152606401610430565b6001600160a01b03831660009081526001602090815260408083205460029092529091205460ff906105f2908361125e565b11156106555760405162461bcd60e51b815260206004820152602c60248201527f56657374696e673a204d6178206167656e646173207265616368656420666f7260448201526b2062656e656669636961727960a01b6064820152608401610430565b4260006106827f000000000000000000000000000000000000000000000000000000000000000083611271565b604080518082019091528681526020810182905290915060006106a58886610d2b565b6001600160a01b03891660009081526001602052604081208054929350906106cc83611284565b909155505060008181526003602090815260409182902084518155848201516001909101558151898152908101839052908101859052606081018490526001600160a01b038916907f66f939753fe55ed8e71143b010d554a70be0aad4fbdd8dd149ea81cd63a0be259060800160405180910390a25050505050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b7fb0e3ae34a3ebd864ed280a15abe71cbcaf59103e086737862f5bbccae6a44b3761079e81610987565b600082116107e85760405162461bcd60e51b815260206004820152601760248201527656657374696e673a20616d6f756e74206973207a65726f60481b6044820152606401610430565b6001600160a01b03831661084f5760405162461bcd60e51b815260206004820152602860248201527f56657374696e673a206167656e64614f776e657220697320746865207a65726f604482015267206164647265737360c01b6064820152608401610430565b338261085d85826001610a7d565b146108aa5760405162461bcd60e51b815260206004820152601f60248201527f56657374696e673a20616d6f756e7420657863656564732062616c616e6365006044820152606401610430565b6108de6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168285610c4b565b806001600160a01b0316846001600160a01b03167fd1c19fbcd4551a5edfb66d43d2e337c04837afda3482b42bdf569a8fccdae5fb8560405161092391815260200190565b60405180910390a350505050565b60008061093d83610c9d565b949350505050565b60008281526020819052604090206001015461096081610987565b6103bf8383610a18565b600080600061097884610c9d565b909250905061093d828261125e565b6109918133610d72565b50565b61099e828261074b565b610443576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556109d43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610a22828261074b565b15610443576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6001600160a01b038316600090815260016020908152604080832054600290925282205442815b83811015610bf0578615610bf0576000610abe8983610d2b565b60008181526003602052604081206001810154929350919003610ae2575050610bde565b87158015610af35750806001015484105b15610aff575050610bde565b80548911610b7e5788816000016000828254610b1b919061125e565b90915550610b2b90508988611271565b815460009a509097508903610b79576001600160a01b038a166000908152600260205260408120805491610b5e83611284565b90915550506000828152600360205260408120818155600101555b610bdb565b8054610b8a908a61125e565b8154909950610b999088611271565b6001600160a01b038b166000908152600260205260408120805492995090610bc083611284565b90915550506000828152600360205260408120818155600101555b50505b80610be881611284565b915050610aa4565b5060008411610c415760405162461bcd60e51b815260206004820152601860248201527f56657374696e673a2062616c616e6365206973207a65726f00000000000000006044820152606401610430565b5050509392505050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526103bf908490610dcb565b6001600160a01b038116600090815260016020908152604080832054600290925282205482919042815b83811015610d22576000610cdb8883610d2b565b60008181526003602052604090206001810154919250908410610d07578054610d049089611271565b97505b8054610d139088611271565b96508260010192505050610cc7565b50505050915091565b6040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160405160208183030381529060405280519060200120905092915050565b610d7c828261074b565b61044357610d8981610ea0565b610d94836020610eb2565b604051602001610da59291906112c1565b60408051601f198184030181529082905262461bcd60e51b825261043091600401611336565b6000610e20826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166110559092919063ffffffff16565b9050805160001480610e41575080806020019051810190610e419190611369565b6103bf5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610430565b60606103946001600160a01b03831660145b60606000610ec183600261138b565b610ecc906002611271565b67ffffffffffffffff811115610ee457610ee46113a2565b6040519080825280601f01601f191660200182016040528015610f0e576020820181803683370190505b509050600360fc1b81600081518110610f2957610f296113b8565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610f5857610f586113b8565b60200101906001600160f81b031916908160001a9053506000610f7c84600261138b565b610f87906001611271565b90505b6001811115610fff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610fbb57610fbb6113b8565b1a60f81b828281518110610fd157610fd16113b8565b60200101906001600160f81b031916908160001a90535060049490941c93610ff8816113ce565b9050610f8a565b50831561104e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610430565b9392505050565b606061093d848460008585600080866001600160a01b0316858760405161107c91906113e5565b60006040518083038185875af1925050503d80600081146110b9576040519150601f19603f3d011682016040523d82523d6000602084013e6110be565b606091505b50915091506110cf878383876110da565b979650505050505050565b60608315611149578251600003611142576001600160a01b0385163b6111425760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610430565b508161093d565b61093d838381511561115e5781518083602001fd5b8060405162461bcd60e51b81526004016104309190611336565b60006020828403121561118a57600080fd5b81356001600160e01b03198116811461104e57600080fd5b6000602082840312156111b457600080fd5b5035919050565b80356001600160a01b03811681146111d257600080fd5b919050565b600080604083850312156111ea57600080fd5b823591506111fa602084016111bb565b90509250929050565b60006020828403121561121557600080fd5b61104e826111bb565b6000806040838503121561123157600080fd5b61123a836111bb565b946020939093013593505050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561039457610394611248565b8082018082111561039457610394611248565b60006001820161129657611296611248565b5060010190565b60005b838110156112b85781810151838201526020016112a0565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516112f981601785016020880161129d565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161132a81602884016020880161129d565b01602801949350505050565b602081526000825180602084015261135581604085016020870161129d565b601f01601f19169190910160400192915050565b60006020828403121561137b57600080fd5b8151801515811461104e57600080fd5b808202811582820484141761039457610394611248565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000816113dd576113dd611248565b506000190190565b600082516113f781846020870161129d565b919091019291505056fea2646970667358221220a8d8aa88e2bcdb725f9db2953cb005acf9ecd65799e096114aa89719e515c6fa64736f6c63430008120033b0e3ae34a3ebd864ed280a15abe71cbcaf59103e086737862f5bbccae6a44b3714dd327f3834be9d0f7cf44f6cf11c96ded83bd68d1a1b3926d35739e7bb88d03515f38d031dcbca5f1dac4c5afc1efca2020e42efdd9c5806ae7e963d18435aa2646970667358221220994601046370c45cada03086fe44956e8eb7e5ff2660d5bfbd98ca98d68b578b64736f6c63430008120033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000004000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad200000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e004610000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
-----Decoded View---------------
Arg [0] : stablecoins_ (address[]): 0xc2132D05D31c914a87C6611C10748AEb04B58e8F,0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
Arg [1] : decimals_ (uint256): 4
Arg [2] : fundingWalletAddress_ (address): 0xF447c79218F9fDB4aA42eB151c06eD59d8A04AD2
Arg [3] : sellingTokenAddress_ (address): 0x70F300FE3c8d62A169D3c1d656D284c3b4E00461
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [2] : 000000000000000000000000f447c79218f9fdb4aa42eb151c06ed59d8a04ad2
Arg [3] : 00000000000000000000000070f300fe3c8d62a169d3c1d656d284c3b4e00461
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [5] : 000000000000000000000000c2132d05d31c914a87c6611c10748aeb04b58e8f
Arg [6] : 0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 35 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | 100.00% | $0.999937 | 302 | $301.98 |
Loading...
Loading
Loading...
Loading
[ 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.