Contract
0xca49ecf7e7bb9bbc9d1d295384663f6ba5c0e366
21
My Name Tag:
Not Available, login to update
[ Download CSV Export ]
Latest 22 internal transactions
[ Download CSV Export ]
Contract Name:
Shop
Compiler Version
v0.8.6+commit.11564f7e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/* ██ ██ ██████ █████ ██████ ███████ ██ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ███████ ██ ██ ███████ ███████ ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██████ ███████ ██ ██ ██████ ██ */ // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./LP.sol"; import "../interfaces/IFactory.sol"; import "../interfaces/IDao.sol"; import "../interfaces/ILP.sol"; contract Shop is ReentrancyGuard { using SafeERC20 for IERC20; address public factory = address(0); mapping(address => bool) public lps; struct PublicOffer { bool isActive; address currency; uint256 rate; // lpAmount = currencyAmount / rate. For example: 1 LP = 100 USDT. 530 USDT -> 530/100 = 5.3 LP } mapping(address => PublicOffer) public publicOffers; // publicOffers[dao] struct PrivateOffer { bool isActive; address recipient; address currency; uint256 currencyAmount; uint256 lpAmount; } mapping(address => mapping(uint256 => PrivateOffer)) public privateOffers; // privateOffers[dao][offerId] mapping(address => uint256) public numberOfPrivateOffers; event LpCreated(address indexed lp); modifier onlyDaoWithLp() { require( IFactory(factory).containsDao(msg.sender) && IDao(msg.sender).lp() != address(0), "Shop: this function is only for DAO with LP" ); _; } function setFactory(address _factory) external returns (bool) { require( factory == address(0), "Shop: factory address has already been set" ); factory = _factory; return true; } function createLp(string memory _lpName, string memory _lpSymbol) external nonReentrant returns (bool) { require( IFactory(factory).containsDao(msg.sender), "Shop: only DAO can deploy LP" ); LP lp = new LP(_lpName, _lpSymbol, msg.sender); lps[address(lp)] = true; emit LpCreated(address(lp)); bool b = IDao(msg.sender).setLp(address(lp)); require(b, "Shop: LP setting error"); return true; } // DAO can use this to create/enable/disable/changeCurrency/changeRate function initPublicOffer( bool _isActive, address _currency, uint256 _rate ) external onlyDaoWithLp returns (bool) { publicOffers[msg.sender] = PublicOffer({ isActive: _isActive, currency: _currency, rate: _rate }); return true; } function createPrivateOffer( address _recipient, address _currency, uint256 _currencyAmount, uint256 _lpAmount ) external onlyDaoWithLp returns (bool) { privateOffers[msg.sender][ numberOfPrivateOffers[msg.sender] ] = PrivateOffer({ isActive: true, recipient: _recipient, currency: _currency, currencyAmount: _currencyAmount, lpAmount: _lpAmount }); numberOfPrivateOffers[msg.sender]++; return true; } function disablePrivateOffer(uint256 _id) external onlyDaoWithLp returns (bool) { privateOffers[msg.sender][_id].isActive = false; return true; } function buyPublicOffer(address _dao, uint256 _lpAmount) external nonReentrant returns (bool) { require( IFactory(factory).containsDao(_dao), "Shop: only DAO can sell LPs" ); PublicOffer memory publicOffer = publicOffers[_dao]; require(publicOffer.isActive, "Shop: this offer is disabled"); IERC20(publicOffer.currency).safeTransferFrom( msg.sender, _dao, (_lpAmount * publicOffer.rate) / 1e18 ); address lp = IDao(_dao).lp(); bool b = ILP(lp).mint(msg.sender, _lpAmount); require(b, "Shop: mint error"); return true; } function buyPrivateOffer(address _dao, uint256 _id) external nonReentrant returns (bool) { require( IFactory(factory).containsDao(_dao), "Shop: only DAO can sell LPs" ); PrivateOffer storage offer = privateOffers[_dao][_id]; require(offer.isActive, "Shop: this offer is disabled"); offer.isActive = false; require(offer.recipient == msg.sender, "Shop: wrong recipient"); IERC20(offer.currency).safeTransferFrom( msg.sender, _dao, offer.currencyAmount ); address lp = IDao(_dao).lp(); bool b = ILP(lp).mint(msg.sender, offer.lpAmount); require(b, "Shop: mint error"); return true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `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); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
/* ██ ██ ██████ █████ ██████ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ███████ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██████ ███████ ██ */ // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "../interfaces/IDao.sol"; contract LP is ReentrancyGuard, ERC20, ERC20Permit { address public immutable dao; address public immutable shop; bool public mintable = true; bool public burnable = true; bool public mintableStatusFrozen = false; bool public burnableStatusFrozen = false; constructor( string memory _name, string memory _symbol, address _dao ) ERC20(_name, _symbol) ERC20Permit(_name) { dao = _dao; shop = msg.sender; } modifier onlyDao() { require(msg.sender == dao, "LP: caller is not the dao"); _; } modifier onlyShop() { require(msg.sender == shop, "LP: caller is not the shop"); _; } function mint(address _to, uint256 _amount) external onlyShop returns (bool) { require(mintable, "LP: minting is disabled"); _mint(_to, _amount); return true; } function burn( uint256 _amount, address[] memory _tokens, address[] memory _adapters, address[] memory _pools ) external nonReentrant returns (bool) { require(burnable, "LP: burning is disabled"); require(msg.sender != dao, "LP: DAO can't burn LP"); require(_amount <= balanceOf(msg.sender), "LP: insufficient balance"); require(totalSupply() > 0, "LP: Zero share"); uint256 _share = (1e18 * _amount) / (totalSupply()); _burn(msg.sender, _amount); bool b = IDao(dao).burnLp( msg.sender, _share, _tokens, _adapters, _pools ); require(b, "LP: burning error"); return true; } function changeMintable(bool _mintable) external onlyDao returns (bool) { require(!mintableStatusFrozen, "LP: minting status is frozen"); mintable = _mintable; return true; } function changeBurnable(bool _burnable) external onlyDao returns (bool) { require(!burnableStatusFrozen, "LP: burnable status is frozen"); burnable = _burnable; return true; } function freezeMintingStatus() external onlyDao returns (bool) { mintableStatusFrozen = true; return true; } function freezeBurningStatus() external onlyDao returns (bool) { burnableStatusFrozen = true; return true; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.6; interface IFactory { function getDaos() external view returns (address[] memory); function shop() external view returns (address); function monthlyCost() external view returns (uint256); function subscriptions(address _dao) external view returns (uint256); function containsDao(address _dao) external view returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.6; interface IDao { function name() external view returns (string memory); function symbol() external view returns (string memory); function lp() external view returns (address); function burnLp( address _recipient, uint256 _share, address[] memory _tokens, address[] memory _adapters, address[] memory _pools ) external returns (bool); function setLp(address _lp) external returns (bool); function quorum() external view returns (uint8); function executedTx(bytes32 _txHash) external view returns (bool); function mintable() external view returns (bool); function burnable() external view returns (bool); function numberOfPermitted() external view returns (uint256); function numberOfAdapters() external view returns (uint256); function executePermitted( address _target, bytes calldata _data, uint256 _value ) external returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.6; interface ILP { function name() external view returns (string memory); function symbol() external view returns (string memory); function mint(address _to, uint256 _amount) external returns (bool); function mintable() external view returns (bool); function burnable() external view returns (bool); function mintableStatusFrozen() external view returns (bool); function burnableStatusFrozen() external view returns (bool); function burn( uint256 _amount, address[] memory _tokens, address[] memory _adapters, address[] memory _pools ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; import "./draft-IERC20Permit.sol"; import "../ERC20.sol"; import "../../../utils/cryptography/draft-EIP712.sol"; import "../../../utils/cryptography/ECDSA.sol"; import "../../../utils/Counters.sol"; /** * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private immutable _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @dev See {IERC20Permit-permit}. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @dev See {IERC20Permit-nonces}. */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @dev See {IERC20Permit-DOMAIN_SEPARATOR}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } }
// 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 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 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"lp","type":"address"}],"name":"LpCreated","type":"event"},{"inputs":[{"internalType":"address","name":"_dao","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"buyPrivateOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_dao","type":"address"},{"internalType":"uint256","name":"_lpAmount","type":"uint256"}],"name":"buyPublicOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_lpName","type":"string"},{"internalType":"string","name":"_lpSymbol","type":"string"}],"name":"createLp","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"address","name":"_currency","type":"address"},{"internalType":"uint256","name":"_currencyAmount","type":"uint256"},{"internalType":"uint256","name":"_lpAmount","type":"uint256"}],"name":"createPrivateOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"disablePrivateOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_isActive","type":"bool"},{"internalType":"address","name":"_currency","type":"address"},{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"initPublicOffer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lps","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"numberOfPrivateOffers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"privateOffers","outputs":[{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"currencyAmount","type":"uint256"},{"internalType":"uint256","name":"lpAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"publicOffers","outputs":[{"internalType":"bool","name":"isActive","type":"bool"},{"internalType":"address","name":"currency","type":"address"},{"internalType":"uint256","name":"rate","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_factory","type":"address"}],"name":"setFactory","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052600180546001600160a01b031916905534801561002057600080fd5b506001600055613922806100356000396000f3fe60806040523480156200001157600080fd5b5060043610620000c35760003560e01c8063bfd98dc1116200007a578063bfd98dc114620001fc578063c45a01551462000213578063d12e73321462000240578063d249a9781462000266578063d2ea985314620002ca578063e8bbc83614620002e157600080fd5b80631f20b10214620000c85780633c0f968d14620000f45780634e5bfe06146200012657806356819c80146200013d5780635bb478081462000154578063b8923429146200016b575b600080fd5b620000df620000d93660046200149a565b620002f8565b60405190151581526020015b60405180910390f35b62000117620001053660046200145a565b60056020526000908152604090205481565b604051908152602001620000eb565b620000df620001373660046200157a565b6200050f565b620000df6200014e36600462001534565b62000771565b620000df620001653660046200145a565b62000917565b620001c56200017c366004620014e5565b6004602090815260009283526040808420909152908252902080546001820154600283015460039093015460ff8316936101009093046001600160a01b03908116939216919085565b6040805195151586526001600160a01b03948516602087015292909316918401919091526060830152608082015260a001620000eb565b620000df6200020d366004620015e5565b620009ac565b60015462000227906001600160a01b031681565b6040516001600160a01b039091168152602001620000eb565b620000df620002513660046200145a565b60026020526000908152604090205460ff1681565b620002a4620002773660046200145a565b6003602052600090815260409020805460019091015460ff82169161010090046001600160a01b03169083565b6040805193151584526001600160a01b03909216602084015290820152606001620000eb565b620000df620002db366004620014e5565b62000b06565b620000df620002f2366004620014e5565b62000e38565b6001546040516396d054e560e01b81523360048201526000916001600160a01b0316906396d054e59060240160206040518083038186803b1580156200033d57600080fd5b505afa15801562000352573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000378919062001514565b80156200040c575060006001600160a01b0316336001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b158015620003c557600080fd5b505afa158015620003da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200040091906200147a565b6001600160a01b031614155b620004345760405162461bcd60e51b81526004016200042b90620016d9565b60405180910390fd5b6040805160a08101825260018082526001600160a01b038881166020808501918252898316858701908152606086018a8152608087018a8152336000818152600486528a812060058088528c8320805484529188529b82209a518b5498516001600160a81b0319909916901515610100600160a81b03191617610100988a1698909802979097178a55935197890180546001600160a01b0319169890971697909717909555516002870155925160039095019490945591815292909152805491620004ff8362001798565b9091555060019695505050505050565b600060026000541415620005375760405162461bcd60e51b81526004016200042b90620016a2565b60026000556001546040516396d054e560e01b81523360048201526001600160a01b03909116906396d054e59060240160206040518083038186803b1580156200058057600080fd5b505afa15801562000595573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005bb919062001514565b620006095760405162461bcd60e51b815260206004820152601c60248201527f53686f703a206f6e6c792044414f2063616e206465706c6f79204c500000000060448201526064016200042b565b60008383336040516200061c90620013b7565b6200062a9392919062001660565b604051809103906000f08015801562000647573d6000803e3d6000fd5b506001600160a01b038116600081815260026020526040808220805460ff191660011790555192935090917fac4bd1fef3edbe329718924027e53821b2496a5710d5ffd3afb2b3789e746d629190a260405163f4c2baa960e01b81526001600160a01b0382166004820152600090339063f4c2baa990602401602060405180830381600087803b158015620006db57600080fd5b505af1158015620006f0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000716919062001514565b905080620007605760405162461bcd60e51b815260206004820152601660248201527529b437b81d1026281039b2ba3a34b7339032b93937b960511b60448201526064016200042b565b600192505050600160005592915050565b6001546040516396d054e560e01b81523360048201526000916001600160a01b0316906396d054e59060240160206040518083038186803b158015620007b657600080fd5b505afa158015620007cb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007f1919062001514565b801562000885575060006001600160a01b0316336001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b1580156200083e57600080fd5b505afa15801562000853573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200087991906200147a565b6001600160a01b031614155b620008a45760405162461bcd60e51b81526004016200042b90620016d9565b506040805160608101825284151581526001600160a01b03848116602080840191825283850186815233600090815260039092529490209251835491516001600160a81b0319909216901515610100600160a81b03191617610100919092160217815590516001918201555b9392505050565b6001546000906001600160a01b031615620009885760405162461bcd60e51b815260206004820152602a60248201527f53686f703a20666163746f727920616464726573732068617320616c726561646044820152691e481899595b881cd95d60b21b60648201526084016200042b565b50600180546001600160a01b0319166001600160a01b039290921691909117815590565b6001546040516396d054e560e01b81523360048201526000916001600160a01b0316906396d054e59060240160206040518083038186803b158015620009f157600080fd5b505afa15801562000a06573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a2c919062001514565b801562000ac0575060006001600160a01b0316336001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b15801562000a7957600080fd5b505afa15801562000a8e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ab491906200147a565b6001600160a01b031614155b62000adf5760405162461bcd60e51b81526004016200042b90620016d9565b5033600090815260046020908152604080832093835292905220805460ff19169055600190565b60006002600054141562000b2e5760405162461bcd60e51b81526004016200042b90620016a2565b60026000556001546040516396d054e560e01b81526001600160a01b038581166004830152909116906396d054e59060240160206040518083038186803b15801562000b7957600080fd5b505afa15801562000b8e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bb4919062001514565b62000c025760405162461bcd60e51b815260206004820152601b60248201527f53686f703a206f6e6c792044414f2063616e2073656c6c204c5073000000000060448201526064016200042b565b6001600160a01b038084166000908152600360209081526040918290208251606081018452815460ff811615158083526101009091049095169281019290925260010154918101919091529062000c9c5760405162461bcd60e51b815260206004820152601c60248201527f53686f703a2074686973206f666665722069732064697361626c65640000000060448201526064016200042b565b62000ce03385670de0b6b3a764000084604001518762000cbd919062001747565b62000cc9919062001724565b60208501516001600160a01b0316929190620010e5565b6000846001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b15801562000d1c57600080fd5b505afa15801562000d31573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000d5791906200147a565b6040516340c10f1960e01b8152336004820152602481018690529091506000906001600160a01b038316906340c10f19906044015b602060405180830381600087803b15801562000da757600080fd5b505af115801562000dbc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000de2919062001514565b90508062000e265760405162461bcd60e51b815260206004820152601060248201526f29b437b81d1036b4b73a1032b93937b960811b60448201526064016200042b565b60019350505050600160005592915050565b60006002600054141562000e605760405162461bcd60e51b81526004016200042b90620016a2565b60026000556001546040516396d054e560e01b81526001600160a01b038581166004830152909116906396d054e59060240160206040518083038186803b15801562000eab57600080fd5b505afa15801562000ec0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ee6919062001514565b62000f345760405162461bcd60e51b815260206004820152601b60248201527f53686f703a206f6e6c792044414f2063616e2073656c6c204c5073000000000060448201526064016200042b565b6001600160a01b03831660009081526004602090815260408083208584529091529020805460ff1662000faa5760405162461bcd60e51b815260206004820152601c60248201527f53686f703a2074686973206f666665722069732064697361626c65640000000060448201526064016200042b565b805460ff191680825561010090046001600160a01b03163314620010095760405162461bcd60e51b815260206004820152601560248201527414da1bdc0e881ddc9bdb99c81c9958da5c1a595b9d605a1b60448201526064016200042b565b600281015460018201546200102e916001600160a01b039091169033908790620010e5565b6000846001600160a01b031663313c06a06040518163ffffffff1660e01b815260040160206040518083038186803b1580156200106a57600080fd5b505afa1580156200107f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620010a591906200147a565b60038301546040516340c10f1960e01b815233600482015260248101919091529091506000906001600160a01b038316906340c10f199060440162000d8c565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526200114190859062001147565b50505050565b60006200119e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620012259092919063ffffffff16565b805190915015620012205780806020019051810190620011bf919062001514565b620012205760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016200042b565b505050565b60606200123684846000856200123e565b949350505050565b606082471015620012a15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016200042b565b6001600160a01b0385163b620012fa5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016200042b565b600080866001600160a01b031685876040516200131891906200162d565b60006040518083038185875af1925050503d806000811462001357576040519150601f19603f3d011682016040523d82523d6000602084013e6200135c565b606091505b50915091506200136e82828662001379565b979650505050505050565b606083156200138a57508162000910565b8251156200139b5782518084602001fd5b8160405162461bcd60e51b81526004016200042b91906200164b565b6120e2806200180b83390190565b600082601f830112620013d757600080fd5b813567ffffffffffffffff80821115620013f557620013f5620017cc565b604051601f8301601f19908116603f01168101908282118183101715620014205762001420620017cc565b816040528381528660208588010111156200143a57600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000602082840312156200146d57600080fd5b81356200091081620017e2565b6000602082840312156200148d57600080fd5b81516200091081620017e2565b60008060008060808587031215620014b157600080fd5b8435620014be81620017e2565b93506020850135620014d081620017e2565b93969395505050506040820135916060013590565b60008060408385031215620014f957600080fd5b82356200150681620017e2565b946020939093013593505050565b6000602082840312156200152757600080fd5b81516200091081620017fb565b6000806000606084860312156200154a57600080fd5b83356200155781620017fb565b925060208401356200156981620017e2565b929592945050506040919091013590565b600080604083850312156200158e57600080fd5b823567ffffffffffffffff80821115620015a757600080fd5b620015b586838701620013c5565b93506020850135915080821115620015cc57600080fd5b50620015db85828601620013c5565b9150509250929050565b600060208284031215620015f857600080fd5b5035919050565b600081518084526200161981602086016020860162001769565b601f01601f19169290920160200192915050565b600082516200164181846020870162001769565b9190910192915050565b602081526000620009106020830184620015ff565b606081526000620016756060830186620015ff565b8281036020840152620016898186620015ff565b91505060018060a01b0383166040830152949350505050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252602b908201527f53686f703a20746869732066756e6374696f6e206973206f6e6c7920666f722060408201526a044414f2077697468204c560ac1b606082015260800190565b6000826200174257634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615620017645762001764620017b6565b500290565b60005b83811015620017865781810151838201526020016200176c565b83811115620011415750506000910152565b6000600019821415620017af57620017af620017b6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114620017f857600080fd5b50565b8015158114620017f857600080fdfe6101a06040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610140526007805463ffffffff19166101011790553480156200004857600080fd5b50604051620020e2380380620020e28339810160408190526200006b91620002db565b8280604051806040016040528060018152602001603160f81b815250858560016000819055508160049080519060200190620000a99291906200017e565b508051620000bf9060059060208401906200017e565b5050825160208085019190912083518483012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919350919060805230606090811b60c0526101209190915295861b6001600160601b031916610160525050503390921b6101805250620003bb92505050565b8280546200018c9062000368565b90600052602060002090601f016020900481019282620001b05760008555620001fb565b82601f10620001cb57805160ff1916838001178555620001fb565b82800160010185558215620001fb579182015b82811115620001fb578251825591602001919060010190620001de565b50620002099291506200020d565b5090565b5b808211156200020957600081556001016200020e565b600082601f8301126200023657600080fd5b81516001600160401b0380821115620002535762000253620003a5565b604051601f8301601f19908116603f011681019082821181831017156200027e576200027e620003a5565b816040528381526020925086838588010111156200029b57600080fd5b600091505b83821015620002bf5785820183015181830184015290820190620002a0565b83821115620002d15760008385830101525b9695505050505050565b600080600060608486031215620002f157600080fd5b83516001600160401b03808211156200030957600080fd5b620003178783880162000224565b945060208601519150808211156200032e57600080fd5b506200033d8682870162000224565b604086015190935090506001600160a01b03811681146200035d57600080fd5b809150509250925092565b600181811c908216806200037d57607f821691505b602082108114156200039f57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160a05160c05160601c60e0516101005161012051610140516101605160601c6101805160601c611c7c62000466600039600081816101b601526105760152600081816102950152818161049a01528181610655015281816107de01528181610ab201528181610c0d0152610cff015260006108e601526000611164015260006111b30152600061118e015260006110e7015260006111110152600061113b0152611c7c6000f3fe608060405234801561001057600080fd5b506004361061018e5760003560e01c80634bf365df116100de578063a9059cbb11610097578063dd62ed3e11610071578063dd62ed3e1461037b578063ec5a4bdd146103b4578063f7dab517146103c7578063f85ca187146103db57600080fd5b8063a9059cbb14610340578063c91f2ef914610353578063d505accf1461036657600080fd5b80634bf365df146102ca57806370a08231146102d75780637ecebe001461030057806395d89b4114610313578063a07c7ce41461031b578063a457c2d71461032d57600080fd5b806323b872dd1161014b5780633950935111610125578063395093511461026a57806340c10f191461027d5780634162169f146102905780634779b82e146102b757600080fd5b806323b872dd14610240578063313ce567146102535780633644e5151461026257600080fd5b806306fdde03146101935780630881fa0d146101b1578063095ea7b3146101f057806315ba0e651461021357806318160ddd1461022657806322bec6b814610238575b600080fd5b61019b6103e3565b6040516101a89190611ac5565b60405180910390f35b6101d87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016101a8565b6102036101fe366004611932565b610475565b60405190151581526020016101a8565b6007546102039062010000900460ff1681565b6003545b6040519081526020016101a8565b61020361048d565b61020361024e366004611883565b6104f7565b604051601281526020016101a8565b61022a61051b565b610203610278366004611932565b61052a565b61020361028b366004611932565b610569565b6101d87f000000000000000000000000000000000000000000000000000000000000000081565b6102036102c536600461195c565b610648565b6007546102039060ff1681565b61022a6102e536600461182e565b6001600160a01b031660009081526001602052604090205490565b61022a61030e36600461182e565b610702565b61019b610722565b60075461020390610100900460ff1681565b61020361033b366004611932565b610731565b61020361034e366004611932565b6107c3565b61020361036136600461195c565b6107d1565b6103796103743660046118bf565b610892565b005b61022a610389366004611850565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6102036103c2366004611996565b6109f6565b600754610203906301000000900460ff1681565b610203610cf2565b6060600480546103f290611bc1565b80601f016020809104026020016040519081016040528092919081815260200182805461041e90611bc1565b801561046b5780601f106104405761010080835404028352916020019161046b565b820191906000526020600020905b81548152906001019060200180831161044e57829003601f168201915b5050505050905090565b600033610483818585610d55565b5060019392505050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104e05760405162461bcd60e51b81526004016104d790611b1a565b60405180910390fd5b506007805462ff0000191662010000179055600190565b600033610505858285610e7a565b610510858585610f0c565b506001949350505050565b60006105256110da565b905090565b3360008181526002602090815260408083206001600160a01b03871684529091528120549091906104839082908690610564908790611b51565b610d55565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146105e35760405162461bcd60e51b815260206004820152601a60248201527f4c503a2063616c6c6572206973206e6f74207468652073686f7000000000000060448201526064016104d7565b60075460ff166106355760405162461bcd60e51b815260206004820152601760248201527f4c503a206d696e74696e672069732064697361626c656400000000000000000060448201526064016104d7565b61063f8383611201565b50600192915050565b6000336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106925760405162461bcd60e51b81526004016104d790611b1a565b60075462010000900460ff16156106eb5760405162461bcd60e51b815260206004820152601c60248201527f4c503a206d696e74696e67207374617475732069732066726f7a656e0000000060448201526064016104d7565b506007805460ff191682151517905560015b919050565b6001600160a01b0381166000908152600660205260408120545b92915050565b6060600580546103f290611bc1565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909190838110156107b65760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016104d7565b6105108286868403610d55565b600033610483818585610f0c565b6000336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461081b5760405162461bcd60e51b81526004016104d790611b1a565b6007546301000000900460ff16156108755760405162461bcd60e51b815260206004820152601d60248201527f4c503a206275726e61626c65207374617475732069732066726f7a656e00000060448201526064016104d7565b50600780548215156101000261ff00199091161790556001919050565b834211156108e25760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e6500000060448201526064016104d7565b60007f00000000000000000000000000000000000000000000000000000000000000008888886109118c6112e0565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e001604051602081830303815290604052805190602001209050600061096c82611308565b9050600061097c82878787611356565b9050896001600160a01b0316816001600160a01b0316146109df5760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e6174757265000060448201526064016104d7565b6109ea8a8a8a610d55565b50505050505050505050565b600060026000541415610a4b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016104d7565b6002600055600754610100900460ff16610aa75760405162461bcd60e51b815260206004820152601760248201527f4c503a206275726e696e672069732064697361626c656400000000000000000060448201526064016104d7565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161415610b185760405162461bcd60e51b815260206004820152601560248201527404c503a2044414f2063616e2774206275726e204c5605c1b60448201526064016104d7565b33600090815260016020526040902054851115610b775760405162461bcd60e51b815260206004820152601860248201527f4c503a20696e73756666696369656e742062616c616e6365000000000000000060448201526064016104d7565b6000610b8260035490565b11610bc05760405162461bcd60e51b815260206004820152600e60248201526d4c503a205a65726f20736861726560901b60448201526064016104d7565b6000610bcb60035490565b610bdd87670de0b6b3a7640000611b8b565b610be79190611b69565b9050610bf3338761137e565b604051637dd2731760e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063fba4e62e90610c4a90339086908b908b908b90600401611a6c565b602060405180830381600087803b158015610c6457600080fd5b505af1158015610c78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c9c9190611979565b905080610cdf5760405162461bcd60e51b815260206004820152601160248201527026281d10313ab93734b7339032b93937b960791b60448201526064016104d7565b6001925050506001600055949350505050565b6000336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610d3c5760405162461bcd60e51b81526004016104d790611b1a565b506007805463ff00000019166301000000179055600190565b6001600160a01b038316610db75760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104d7565b6001600160a01b038216610e185760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104d7565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038381166000908152600260209081526040808320938616835292905220546000198114610f065781811015610ef95760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104d7565b610f068484848403610d55565b50505050565b6001600160a01b038316610f705760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104d7565b6001600160a01b038216610fd25760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104d7565b6001600160a01b0383166000908152600160205260409020548181101561104a5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016104d7565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290611081908490611b51565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516110cd91815260200190565b60405180910390a3610f06565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561113357507f000000000000000000000000000000000000000000000000000000000000000046145b1561115d57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b6001600160a01b0382166112575760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104d7565b80600360008282546112699190611b51565b90915550506001600160a01b03821660009081526001602052604081208054839290611296908490611b51565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b6001600160a01b03811660009081526006602052604090208054600181018255905b50919050565b600061071c6113156110da565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611367878787876114c4565b91509150611374816115b1565b5095945050505050565b6001600160a01b0382166113de5760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016104d7565b6001600160a01b038216600090815260016020526040902054818110156114525760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016104d7565b6001600160a01b0383166000908152600160205260408120838303905560038054849290611481908490611baa565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001610e6d565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156114fb57506000905060036115a8565b8460ff16601b1415801561151357508460ff16601c14155b1561152457506000905060046115a8565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611578573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166115a1576000600192509250506115a8565b9150600090505b94509492505050565b60008160048111156115c5576115c5611c0c565b14156115ce5750565b60018160048111156115e2576115e2611c0c565b14156116305760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016104d7565b600281600481111561164457611644611c0c565b14156116925760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104d7565b60038160048111156116a6576116a6611c0c565b14156116ff5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104d7565b600481600481111561171357611713611c0c565b141561176c5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104d7565b50565b80356001600160a01b03811681146106fd57600080fd5b600082601f83011261179757600080fd5b8135602067ffffffffffffffff808311156117b4576117b4611c22565b8260051b604051601f19603f830116810181811084821117156117d9576117d9611c22565b604052848152838101925086840182880185018910156117f857600080fd5b600092505b858310156118225761180e8161176f565b8452928401926001929092019184016117fd565b50979650505050505050565b60006020828403121561184057600080fd5b6118498261176f565b9392505050565b6000806040838503121561186357600080fd5b61186c8361176f565b915061187a6020840161176f565b90509250929050565b60008060006060848603121561189857600080fd5b6118a18461176f565b92506118af6020850161176f565b9150604084013590509250925092565b600080600080600080600060e0888a0312156118da57600080fd5b6118e38861176f565b96506118f16020890161176f565b95506040880135945060608801359350608088013560ff8116811461191557600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561194557600080fd5b61194e8361176f565b946020939093013593505050565b60006020828403121561196e57600080fd5b813561184981611c38565b60006020828403121561198b57600080fd5b815161184981611c38565b600080600080608085870312156119ac57600080fd5b84359350602085013567ffffffffffffffff808211156119cb57600080fd5b6119d788838901611786565b945060408701359150808211156119ed57600080fd5b6119f988838901611786565b93506060870135915080821115611a0f57600080fd5b50611a1c87828801611786565b91505092959194509250565b600081518084526020808501945080840160005b83811015611a615781516001600160a01b031687529582019590820190600101611a3c565b509495945050505050565b60018060a01b038616815284602082015260a060408201526000611a9360a0830186611a28565b8281036060840152611aa58186611a28565b90508281036080840152611ab98185611a28565b98975050505050505050565b600060208083528351808285015260005b81811015611af257858101830151858201604001528201611ad6565b81811115611b04576000604083870101525b50601f01601f1916929092016040019392505050565b60208082526019908201527f4c503a2063616c6c6572206973206e6f74207468652064616f00000000000000604082015260600190565b60008219821115611b6457611b64611bf6565b500190565b600082611b8657634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611ba557611ba5611bf6565b500290565b600082821015611bbc57611bbc611bf6565b500390565b600181811c90821680611bd557607f821691505b6020821081141561130257634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b801515811461176c57600080fdfea26469706673582212202536effcbd541399a241a40bed10236d690017930cea6b777ed4ec3bc52b484164736f6c63430008060033a2646970667358221220789a80730ab341b8d4c49ed0057b3c33de2770946d97ecd1e68900e0b67971b764736f6c63430008060033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.