Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
Latest 25 from a total of 289 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Issue For | 20947657 | 27 days ago | IN | 0 ETH | 0.02028802 | ||||
Claim For | 20810185 | 46 days ago | IN | 0 ETH | 0.00070025 | ||||
Issue For | 20713947 | 59 days ago | IN | 0 ETH | 0.01788177 | ||||
Claim For | 20707389 | 60 days ago | IN | 0 ETH | 0.0000929 | ||||
Issue For | 20682193 | 64 days ago | IN | 0 ETH | 0.00576897 | ||||
Claim For | 20636095 | 70 days ago | IN | 0 ETH | 0.00015005 | ||||
Claim For | 20605241 | 75 days ago | IN | 0 ETH | 0.00012193 | ||||
Issue For | 20605235 | 75 days ago | IN | 0 ETH | 0.00201302 | ||||
Claim For | 20577134 | 78 days ago | IN | 0 ETH | 0.00007271 | ||||
Claim For | 20486325 | 91 days ago | IN | 0 ETH | 0.00023629 | ||||
Claim For | 20444442 | 97 days ago | IN | 0 ETH | 0.00003744 | ||||
Claim For | 20444441 | 97 days ago | IN | 0 ETH | 0.00004391 | ||||
Claim For | 20444440 | 97 days ago | IN | 0 ETH | 0.00014589 | ||||
Claim For | 20414032 | 101 days ago | IN | 0 ETH | 0.00045205 | ||||
Issue For | 20358437 | 109 days ago | IN | 0 ETH | 0.00013958 | ||||
Issue For | 20358436 | 109 days ago | IN | 0 ETH | 0.00978983 | ||||
Issue For | 20313480 | 115 days ago | IN | 0 ETH | 0.05897204 | ||||
Claim For | 20308424 | 116 days ago | IN | 0 ETH | 0.00012113 | ||||
Issue For | 20306937 | 116 days ago | IN | 0 ETH | 0.00700103 | ||||
Issue For | 20250964 | 124 days ago | IN | 0 ETH | 0.00468283 | ||||
Claim For | 20120220 | 142 days ago | IN | 0 ETH | 0.0008608 | ||||
Issue For | 20111788 | 143 days ago | IN | 0 ETH | 0.01089316 | ||||
Claim For | 20058986 | 151 days ago | IN | 0 ETH | 0.00023503 | ||||
Claim For | 20020870 | 156 days ago | IN | 0 ETH | 0.00071107 | ||||
Claim For | 19987348 | 161 days ago | IN | 0 ETH | 0.00040221 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
Contract Name:
JBTokenStore
Compiler Version
v0.8.16+commit.07a7930e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import './abstract/JBControllerUtility.sol'; import './abstract/JBOperatable.sol'; import './interfaces/IJBTokenStore.sol'; import './libraries/JBFundingCycleMetadataResolver.sol'; import './libraries/JBOperations.sol'; import './JBToken.sol'; /** @notice Manage token minting, burning, and account balances. @dev Token balances can be either represented internally or claimed as ERC-20s into wallets. This contract manages these two representations and allows claiming. @dev The total supply of a project's tokens and the balance of each account are calculated in this contract. @dev Each project can bring their own token if they prefer, and swap between tokens at any time. @dev Adheres to - IJBTokenStore: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. @dev Inherits from - JBControllerUtility: Includes convenience functionality for checking if the message sender is the current controller of the project whose data is being manipulated. JBOperatable: Includes convenience functionality for checking a message sender's permissions before executing certain transactions. */ contract JBTokenStore is JBControllerUtility, JBOperatable, IJBTokenStore { // A library that parses the packed funding cycle metadata into a friendlier format. using JBFundingCycleMetadataResolver for JBFundingCycle; //*********************************************************************// // --------------------------- custom errors ------------------------- // //*********************************************************************// error ALREADY_SET(); error EMPTY_NAME(); error EMPTY_SYMBOL(); error EMPTY_TOKEN(); error INSUFFICIENT_FUNDS(); error INSUFFICIENT_UNCLAIMED_TOKENS(); error PROJECT_ALREADY_HAS_TOKEN(); error RECIPIENT_ZERO_ADDRESS(); error TOKEN_NOT_FOUND(); error TOKENS_MUST_HAVE_18_DECIMALS(); error TRANSFERS_PAUSED(); error OVERFLOW_ALERT(); //*********************************************************************// // ---------------- public immutable stored properties --------------- // //*********************************************************************// /** @notice Mints ERC-721's that represent project ownership and transfers. */ IJBProjects public immutable override projects; /** @notice The contract storing all funding cycle configurations. */ IJBFundingCycleStore public immutable override fundingCycleStore; //*********************************************************************// // --------------------- public stored properties -------------------- // //*********************************************************************// /** @notice Each project's attached token contract. _projectId The ID of the project to which the token belongs. */ mapping(uint256 => IJBToken) public override tokenOf; /** @notice The total supply of unclaimed tokens for each project. _projectId The ID of the project to which the token belongs. */ mapping(uint256 => uint256) public override unclaimedTotalSupplyOf; /** @notice Each holder's balance of unclaimed tokens for each project. _holder The holder of balance. _projectId The ID of the project to which the token belongs. */ mapping(address => mapping(uint256 => uint256)) public override unclaimedBalanceOf; //*********************************************************************// // ------------------------- external views -------------------------- // //*********************************************************************// /** @notice The total balance of tokens a holder has for a specified project, including claimed and unclaimed tokens. @param _holder The token holder to get a balance for. @param _projectId The project to get the `_holder`s balance of. @return balance The project token balance of the `_holder */ function balanceOf(address _holder, uint256 _projectId) external view override returns (uint256 balance) { // Get a reference to the holder's unclaimed balance for the project. balance = unclaimedBalanceOf[_holder][_projectId]; // Get a reference to the project's current token. IJBToken _token = tokenOf[_projectId]; // If the project has a current token, add the holder's balance to the total. if (_token != IJBToken(address(0))) balance = balance + _token.balanceOf(_holder, _projectId); } //*********************************************************************// // --------------------------- public views -------------------------- // //*********************************************************************// /** @notice The total supply of tokens for each project, including claimed and unclaimed tokens. @param _projectId The ID of the project to get the total token supply of. @return totalSupply The total supply of the project's tokens. */ function totalSupplyOf(uint256 _projectId) public view override returns (uint256 totalSupply) { // Get a reference to the total supply of the project's unclaimed tokens. totalSupply = unclaimedTotalSupplyOf[_projectId]; // Get a reference to the project's current token. IJBToken _token = tokenOf[_projectId]; // If the project has a current token, add its total supply to the total. if (_token != IJBToken(address(0))) totalSupply = totalSupply + _token.totalSupply(_projectId); } //*********************************************************************// // -------------------------- constructor ---------------------------- // //*********************************************************************// /** @param _operatorStore A contract storing operator assignments. @param _projects A contract which mints ERC-721's that represent project ownership and transfers. @param _directory A contract storing directories of terminals and controllers for each project. @param _fundingCycleStore A contract storing all funding cycle configurations. */ constructor( IJBOperatorStore _operatorStore, IJBProjects _projects, IJBDirectory _directory, IJBFundingCycleStore _fundingCycleStore ) JBOperatable(_operatorStore) JBControllerUtility(_directory) { projects = _projects; fundingCycleStore = _fundingCycleStore; } //*********************************************************************// // ---------------------- external transactions ---------------------- // //*********************************************************************// /** @notice Issues a project's ERC-20 tokens that'll be used when claiming tokens. @dev Deploys a project's ERC-20 token contract. @dev Only a project's owner or operator can issue its token. @param _projectId The ID of the project being issued tokens. @param _name The ERC-20's name. @param _symbol The ERC-20's symbol. @return token The token that was issued. */ function issueFor( uint256 _projectId, string calldata _name, string calldata _symbol ) external override requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.ISSUE) returns (IJBToken token) { // There must be a name. if (bytes(_name).length == 0) revert EMPTY_NAME(); // There must be a symbol. if (bytes(_symbol).length == 0) revert EMPTY_SYMBOL(); // The project shouldn't already have a token. if (tokenOf[_projectId] != IJBToken(address(0))) revert PROJECT_ALREADY_HAS_TOKEN(); // Deploy the token contract. token = new JBToken(_name, _symbol, _projectId); // Store the token contract. tokenOf[_projectId] = token; emit Issue(_projectId, token, _name, _symbol, msg.sender); } /** @notice Set a project's token if not already set. @dev Only a project's owner or operator can set its token. @param _projectId The ID of the project to which the set token belongs. @param _token The new token. */ function setFor(uint256 _projectId, IJBToken _token) external override requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.SET_TOKEN) { // Can't set to the zero address. if (_token == IJBToken(address(0))) revert EMPTY_TOKEN(); // Can't set token if already set. if (tokenOf[_projectId] != IJBToken(address(0))) revert ALREADY_SET(); // Can't change to a token that doesn't use 18 decimals. if (_token.decimals() != 18) revert TOKENS_MUST_HAVE_18_DECIMALS(); // Store the new token. tokenOf[_projectId] = _token; emit Set(_projectId, _token, msg.sender); } /** @notice Mint new project tokens. @dev Only a project's current controller can mint its tokens. @param _holder The address receiving the new tokens. @param _projectId The ID of the project to which the tokens belong. @param _amount The amount of tokens to mint. @param _preferClaimedTokens A flag indicating whether there's a preference for minted tokens to be claimed automatically into the `_holder`s wallet if the project currently has a token contract attached. */ function mintFor( address _holder, uint256 _projectId, uint256 _amount, bool _preferClaimedTokens ) external override onlyController(_projectId) { // Get a reference to the project's current token. IJBToken _token = tokenOf[_projectId]; // Save a reference to whether there exists a token and the caller prefers these claimed tokens. bool _shouldClaimTokens = _preferClaimedTokens && _token != IJBToken(address(0)); if (_shouldClaimTokens) // If tokens should be claimed, mint tokens into the holder's wallet. _token.mint(_projectId, _holder, _amount); else { // Otherwise, add the tokens to the unclaimed balance and total supply. unclaimedBalanceOf[_holder][_projectId] = unclaimedBalanceOf[_holder][_projectId] + _amount; unclaimedTotalSupplyOf[_projectId] = unclaimedTotalSupplyOf[_projectId] + _amount; } // The total supply can't exceed the maximum value storable in a int256. if (totalSupplyOf(_projectId) > type(uint224).max) revert OVERFLOW_ALERT(); emit Mint(_holder, _projectId, _amount, _shouldClaimTokens, _preferClaimedTokens, msg.sender); } /** @notice Burns a project's tokens. @dev Only a project's current controller can burn its tokens. @param _holder The address that owns the tokens being burned. @param _projectId The ID of the project to which the burned tokens belong. @param _amount The amount of tokens to burn. @param _preferClaimedTokens A flag indicating whether there's a preference for tokens to burned from the `_holder`s wallet if the project currently has a token contract attached. */ function burnFrom( address _holder, uint256 _projectId, uint256 _amount, bool _preferClaimedTokens ) external override onlyController(_projectId) { // Get a reference to the project's current token. IJBToken _token = tokenOf[_projectId]; // Get a reference to the amount of unclaimed project tokens the holder has. uint256 _unclaimedBalance = unclaimedBalanceOf[_holder][_projectId]; // Get a reference to the amount of the project's current token the holder has in their wallet. uint256 _claimedBalance = _token == IJBToken(address(0)) ? 0 : _token.balanceOf(_holder, _projectId); // There must be adequate tokens to burn across the holder's claimed and unclaimed balance. if (_amount > _claimedBalance + _unclaimedBalance) revert INSUFFICIENT_FUNDS(); // The amount of tokens to burn. uint256 _claimedTokensToBurn; // Get a reference to how many claimed tokens should be burned if (_claimedBalance != 0) if (_preferClaimedTokens) // If prefer converted, redeem tokens before redeeming unclaimed tokens. _claimedTokensToBurn = _claimedBalance < _amount ? _claimedBalance : _amount; // Otherwise, redeem unclaimed tokens before claimed tokens. else { unchecked { _claimedTokensToBurn = _unclaimedBalance < _amount ? _amount - _unclaimedBalance : 0; } } // The amount of unclaimed tokens to redeem. uint256 _unclaimedTokensToBurn; unchecked { _unclaimedTokensToBurn = _amount - _claimedTokensToBurn; } // Subtract the tokens from the unclaimed balance and total supply. if (_unclaimedTokensToBurn > 0) { // Reduce the holders balance and the total supply. unclaimedBalanceOf[_holder][_projectId] = unclaimedBalanceOf[_holder][_projectId] - _unclaimedTokensToBurn; unclaimedTotalSupplyOf[_projectId] = unclaimedTotalSupplyOf[_projectId] - _unclaimedTokensToBurn; } // Burn the claimed tokens. if (_claimedTokensToBurn > 0) _token.burn(_projectId, _holder, _claimedTokensToBurn); emit Burn( _holder, _projectId, _amount, _unclaimedBalance, _claimedBalance, _preferClaimedTokens, msg.sender ); } /** @notice Claims internally accounted for tokens into a holder's wallet. @dev Only a token holder or an operator specified by the token holder can claim its unclaimed tokens. @param _holder The owner of the tokens being claimed. @param _projectId The ID of the project whose tokens are being claimed. @param _amount The amount of tokens to claim. */ function claimFor( address _holder, uint256 _projectId, uint256 _amount ) external override requirePermission(_holder, _projectId, JBOperations.CLAIM) { // Get a reference to the project's current token. IJBToken _token = tokenOf[_projectId]; // The project must have a token contract attached. if (_token == IJBToken(address(0))) revert TOKEN_NOT_FOUND(); // Get a reference to the amount of unclaimed project tokens the holder has. uint256 _unclaimedBalance = unclaimedBalanceOf[_holder][_projectId]; // There must be enough unclaimed tokens to claim. if (_unclaimedBalance < _amount) revert INSUFFICIENT_UNCLAIMED_TOKENS(); unchecked { // Subtract the claim amount from the holder's unclaimed project token balance. unclaimedBalanceOf[_holder][_projectId] = _unclaimedBalance - _amount; // Subtract the claim amount from the project's unclaimed total supply. unclaimedTotalSupplyOf[_projectId] = unclaimedTotalSupplyOf[_projectId] - _amount; } // Mint the equivalent amount of the project's token for the holder. _token.mint(_projectId, _holder, _amount); emit Claim(_holder, _projectId, _unclaimedBalance, _amount, msg.sender); } /** @notice Allows a holder to transfer unclaimed tokens to another account. @dev Only a token holder or an operator can transfer its unclaimed tokens. @param _holder The address to transfer tokens from. @param _projectId The ID of the project whose tokens are being transferred. @param _recipient The recipient of the tokens. @param _amount The amount of tokens to transfer. */ function transferFrom( address _holder, uint256 _projectId, address _recipient, uint256 _amount ) external override requirePermission(_holder, _projectId, JBOperations.TRANSFER) { // Get a reference to the current funding cycle for the project. JBFundingCycle memory _fundingCycle = fundingCycleStore.currentOf(_projectId); // Must not be paused. if (_fundingCycle.global().pauseTransfers) revert TRANSFERS_PAUSED(); // Can't transfer to the zero address. if (_recipient == address(0)) revert RECIPIENT_ZERO_ADDRESS(); // Get a reference to the holder's unclaimed project token balance. uint256 _unclaimedBalance = unclaimedBalanceOf[_holder][_projectId]; // The holder must have enough unclaimed tokens to transfer. if (_amount > _unclaimedBalance) revert INSUFFICIENT_UNCLAIMED_TOKENS(); // Subtract from the holder's unclaimed token balance. unchecked { unclaimedBalanceOf[_holder][_projectId] = _unclaimedBalance - _amount; } // Add the unclaimed project tokens to the recipient's balance. unclaimedBalanceOf[_recipient][_projectId] = unclaimedBalanceOf[_recipient][_projectId] + _amount; emit Transfer(_holder, _projectId, _recipient, _amount, msg.sender); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.0) (governance/utils/IVotes.sol) pragma solidity ^0.8.0; /** * @dev Common interface for {ERC20Votes}, {ERC721Votes}, and other {Votes}-enabled contracts. * * _Available since v4.5._ */ interface IVotes { /** * @dev Emitted when an account changes their delegate. */ event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate); /** * @dev Emitted when a token transfer or delegate change results in changes to a delegate's number of votes. */ event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance); /** * @dev Returns the current amount of votes that `account` has. */ function getVotes(address account) external view returns (uint256); /** * @dev Returns the amount of votes that `account` had at the end of a past block (`blockNumber`). */ function getPastVotes(address account, uint256 blockNumber) external view returns (uint256); /** * @dev Returns the total supply of votes available at the end of a past block (`blockNumber`). * * NOTE: This value is the sum of all available votes, which is not necessarily the sum of all delegated votes. * Votes that have not been delegated are still part of total supply, even though they would not participate in a * vote. */ function getPastTotalSupply(uint256 blockNumber) external view returns (uint256); /** * @dev Returns the delegate that `account` has chosen. */ function delegates(address account) external view returns (address); /** * @dev Delegates votes from the sender to `delegatee`. */ function delegate(address delegatee) external; /** * @dev Delegates votes from signer to `delegatee`. */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.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: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * 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) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { uint256 currentAllowance = _allowances[sender][_msgSender()]; if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } } _transfer(sender, recipient, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool); /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.0) (token/ERC20/extensions/ERC20Votes.sol) pragma solidity ^0.8.0; import "./draft-ERC20Permit.sol"; import "../../../utils/math/Math.sol"; import "../../../governance/utils/IVotes.sol"; import "../../../utils/math/SafeCast.sol"; import "../../../utils/cryptography/ECDSA.sol"; /** * @dev Extension of ERC20 to support Compound-like voting and delegation. This version is more generic than Compound's, * and supports token supply up to 2^224^ - 1, while COMP is limited to 2^96^ - 1. * * NOTE: If exact COMP compatibility is required, use the {ERC20VotesComp} variant of this module. * * This extension keeps a history (checkpoints) of each account's vote power. Vote power can be delegated either * by calling the {delegate} function directly, or by providing a signature to be used with {delegateBySig}. Voting * power can be queried through the public accessors {getVotes} and {getPastVotes}. * * By default, token balance does not account for voting power. This makes transfers cheaper. The downside is that it * requires users to delegate to themselves in order to activate checkpoints and have their voting power tracked. * * _Available since v4.2._ */ abstract contract ERC20Votes is IVotes, ERC20Permit { struct Checkpoint { uint32 fromBlock; uint224 votes; } bytes32 private constant _DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)"); mapping(address => address) private _delegates; mapping(address => Checkpoint[]) private _checkpoints; Checkpoint[] private _totalSupplyCheckpoints; /** * @dev Get the `pos`-th checkpoint for `account`. */ function checkpoints(address account, uint32 pos) public view virtual returns (Checkpoint memory) { return _checkpoints[account][pos]; } /** * @dev Get number of checkpoints for `account`. */ function numCheckpoints(address account) public view virtual returns (uint32) { return SafeCast.toUint32(_checkpoints[account].length); } /** * @dev Get the address `account` is currently delegating to. */ function delegates(address account) public view virtual override returns (address) { return _delegates[account]; } /** * @dev Gets the current votes balance for `account` */ function getVotes(address account) public view virtual override returns (uint256) { uint256 pos = _checkpoints[account].length; return pos == 0 ? 0 : _checkpoints[account][pos - 1].votes; } /** * @dev Retrieve the number of votes for `account` at the end of `blockNumber`. * * Requirements: * * - `blockNumber` must have been already mined */ function getPastVotes(address account, uint256 blockNumber) public view virtual override returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_checkpoints[account], blockNumber); } /** * @dev Retrieve the `totalSupply` at the end of `blockNumber`. Note, this value is the sum of all balances. * It is but NOT the sum of all the delegated votes! * * Requirements: * * - `blockNumber` must have been already mined */ function getPastTotalSupply(uint256 blockNumber) public view virtual override returns (uint256) { require(blockNumber < block.number, "ERC20Votes: block not yet mined"); return _checkpointsLookup(_totalSupplyCheckpoints, blockNumber); } /** * @dev Lookup a value in a list of (sorted) checkpoints. */ function _checkpointsLookup(Checkpoint[] storage ckpts, uint256 blockNumber) private view returns (uint256) { // We run a binary search to look for the earliest checkpoint taken after `blockNumber`. // // During the loop, the index of the wanted checkpoint remains in the range [low-1, high). // With each iteration, either `low` or `high` is moved towards the middle of the range to maintain the invariant. // - If the middle checkpoint is after `blockNumber`, we look in [low, mid) // - If the middle checkpoint is before or equal to `blockNumber`, we look in [mid+1, high) // Once we reach a single value (when low == high), we've found the right checkpoint at the index high-1, if not // out of bounds (in which case we're looking too far in the past and the result is 0). // Note that if the latest checkpoint available is exactly for `blockNumber`, we end up with an index that is // past the end of the array, so we technically don't find a checkpoint after `blockNumber`, but it works out // the same. uint256 high = ckpts.length; uint256 low = 0; while (low < high) { uint256 mid = Math.average(low, high); if (ckpts[mid].fromBlock > blockNumber) { high = mid; } else { low = mid + 1; } } return high == 0 ? 0 : ckpts[high - 1].votes; } /** * @dev Delegate votes from the sender to `delegatee`. */ function delegate(address delegatee) public virtual override { _delegate(_msgSender(), delegatee); } /** * @dev Delegates votes from signer to `delegatee` */ function delegateBySig( address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= expiry, "ERC20Votes: signature expired"); address signer = ECDSA.recover( _hashTypedDataV4(keccak256(abi.encode(_DELEGATION_TYPEHASH, delegatee, nonce, expiry))), v, r, s ); require(nonce == _useNonce(signer), "ERC20Votes: invalid nonce"); _delegate(signer, delegatee); } /** * @dev Maximum token supply. Defaults to `type(uint224).max` (2^224^ - 1). */ function _maxSupply() internal view virtual returns (uint224) { return type(uint224).max; } /** * @dev Snapshots the totalSupply after it has been increased. */ function _mint(address account, uint256 amount) internal virtual override { super._mint(account, amount); require(totalSupply() <= _maxSupply(), "ERC20Votes: total supply risks overflowing votes"); _writeCheckpoint(_totalSupplyCheckpoints, _add, amount); } /** * @dev Snapshots the totalSupply after it has been decreased. */ function _burn(address account, uint256 amount) internal virtual override { super._burn(account, amount); _writeCheckpoint(_totalSupplyCheckpoints, _subtract, amount); } /** * @dev Move voting power when tokens are transferred. * * Emits a {DelegateVotesChanged} event. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._afterTokenTransfer(from, to, amount); _moveVotingPower(delegates(from), delegates(to), amount); } /** * @dev Change delegation for `delegator` to `delegatee`. * * Emits events {DelegateChanged} and {DelegateVotesChanged}. */ function _delegate(address delegator, address delegatee) internal virtual { address currentDelegate = delegates(delegator); uint256 delegatorBalance = balanceOf(delegator); _delegates[delegator] = delegatee; emit DelegateChanged(delegator, currentDelegate, delegatee); _moveVotingPower(currentDelegate, delegatee, delegatorBalance); } function _moveVotingPower( address src, address dst, uint256 amount ) private { if (src != dst && amount > 0) { if (src != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[src], _subtract, amount); emit DelegateVotesChanged(src, oldWeight, newWeight); } if (dst != address(0)) { (uint256 oldWeight, uint256 newWeight) = _writeCheckpoint(_checkpoints[dst], _add, amount); emit DelegateVotesChanged(dst, oldWeight, newWeight); } } } function _writeCheckpoint( Checkpoint[] storage ckpts, function(uint256, uint256) view returns (uint256) op, uint256 delta ) private returns (uint256 oldWeight, uint256 newWeight) { uint256 pos = ckpts.length; oldWeight = pos == 0 ? 0 : ckpts[pos - 1].votes; newWeight = op(oldWeight, delta); if (pos > 0 && ckpts[pos - 1].fromBlock == block.number) { ckpts[pos - 1].votes = SafeCast.toUint224(newWeight); } else { ckpts.push(Checkpoint({fromBlock: SafeCast.toUint32(block.number), votes: SafeCast.toUint224(newWeight)})); } } function _add(uint256 a, uint256 b) private pure returns (uint256) { return a + b; } function _subtract(uint256 a, uint256 b) private pure returns (uint256) { return a - b; } }
// 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 (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/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 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// 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/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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.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/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 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.5.0-rc.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @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 / b + (a % b == 0 ? 0 : 1); } /** * @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 v4.4.1 (utils/math/SafeCast.sol) pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= type(int128).min && value <= type(int128).max, "SafeCast: value doesn't fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= type(int64).min && value <= type(int64).max, "SafeCast: value doesn't fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= type(int32).min && value <= type(int32).max, "SafeCast: value doesn't fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= type(int16).min && value <= type(int16).max, "SafeCast: value doesn't fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= type(int8).min && value <= type(int8).max, "SafeCast: value doesn't fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import '@openzeppelin/contracts/access/Ownable.sol'; import '@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol'; import './interfaces/IJBToken.sol'; /** @notice An ERC-20 token that can be used by a project in the `JBTokenStore`. @dev Adheres to - IJBToken: Allows this contract to be used by projects in the JBTokenStore. @dev Inherits from - ERC20Votes: General token standard for fungible membership with snapshot capabilities sufficient to interact with standard governance contracts. Ownable: Includes convenience functionality for checking a message sender's permissions before executing certain transactions. */ contract JBToken is ERC20Votes, Ownable, IJBToken { //*********************************************************************// // --------------------------- custom errors ------------------------- // //*********************************************************************// error BAD_PROJECT(); //*********************************************************************// // --------------------- public stored properties -------------------- // //*********************************************************************// /** @notice The ID of the project that this token should be exclusively used for. Send 0 to support any project. */ uint256 public immutable override projectId; //*********************************************************************// // ------------------------- external views -------------------------- // //*********************************************************************// /** @notice The total supply of this ERC20. @param _projectId the ID of the project to which the token belongs. This is ignored. @return The total supply of this ERC20, as a fixed point number. */ function totalSupply(uint256 _projectId) external view override returns (uint256) { _projectId; // Prevents unused var compiler and natspec complaints. return super.totalSupply(); } /** @notice An account's balance of this ERC20. @param _account The account to get a balance of. @param _projectId is the ID of the project to which the token belongs. This is ignored. @return The balance of the `_account` of this ERC20, as a fixed point number with 18 decimals. */ function balanceOf(address _account, uint256 _projectId) external view override returns (uint256) { _account; // Prevents unused var compiler and natspec complaints. _projectId; // Prevents unused var compiler and natspec complaints. return super.balanceOf(_account); } //*********************************************************************// // -------------------------- public views --------------------------- // //*********************************************************************// /** @notice The number of decimals included in the fixed point accounting of this token. @return The number of decimals. */ function decimals() public view override(ERC20, IJBToken) returns (uint8) { return super.decimals(); } //*********************************************************************// // -------------------------- constructor ---------------------------- // //*********************************************************************// /** @param _name The name of the token. @param _symbol The symbol that the token should be represented by. @param _projectId The ID of the project that this token should be exclusively used for. Send 0 to support any project. */ constructor( string memory _name, string memory _symbol, uint256 _projectId ) ERC20(_name, _symbol) ERC20Permit(_name) { projectId = _projectId; } //*********************************************************************// // ---------------------- external transactions ---------------------- // //*********************************************************************// /** @notice Mints more of the token. @dev Only the owner of this contract cant mint more of it. @param _projectId The ID of the project to which the token belongs. This is ignored. @param _account The account to mint the tokens for. @param _amount The amount of tokens to mint, as a fixed point number with 18 decimals. */ function mint( uint256 _projectId, address _account, uint256 _amount ) external override onlyOwner { // Can't mint for a wrong project. if (projectId != 0 && _projectId != projectId) revert BAD_PROJECT(); return _mint(_account, _amount); } /** @notice Burn some outstanding tokens. @dev Only the owner of this contract cant burn some of its supply. @param _projectId The ID of the project to which the token belongs. This is ignored. @param _account The account to burn tokens from. @param _amount The amount of tokens to burn, as a fixed point number with 18 decimals. */ function burn( uint256 _projectId, address _account, uint256 _amount ) external override onlyOwner { // Can't burn for a wrong project. if (projectId != 0 && _projectId != projectId) revert BAD_PROJECT(); return _burn(_account, _amount); } /** @notice Approves an account to spend tokens on the `msg.sender`s behalf. @param _projectId the ID of the project to which the token belongs. This is ignored. @param _spender The address that will be spending tokens on the `msg.sender`s behalf. @param _amount The amount the `_spender` is allowed to spend. */ function approve( uint256 _projectId, address _spender, uint256 _amount ) external override { // Can't approve for a wrong project. if (projectId != 0 && _projectId != projectId) revert BAD_PROJECT(); approve(_spender, _amount); } /** @notice Transfer tokens to an account. @param _projectId The ID of the project to which the token belongs. This is ignored. @param _to The destination address. @param _amount The amount of the transfer, as a fixed point number with 18 decimals. */ function transfer( uint256 _projectId, address _to, uint256 _amount ) external override { // Can't transfer for a wrong project. if (projectId != 0 && _projectId != projectId) revert BAD_PROJECT(); transfer(_to, _amount); } /** @notice Transfer tokens between accounts. @param _projectId The ID of the project to which the token belongs. This is ignored. @param _from The originating address. @param _to The destination address. @param _amount The amount of the transfer, as a fixed point number with 18 decimals. */ function transferFrom( uint256 _projectId, address _from, address _to, uint256 _amount ) external override { // Can't transfer for a wrong project. if (projectId != 0 && _projectId != projectId) revert BAD_PROJECT(); transferFrom(_from, _to, _amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import './../interfaces/IJBControllerUtility.sol'; /** @notice Provides tools for contracts with functionality that can only be accessed by a project's controller. @dev Adheres to - IJBControllerUtility: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. */ abstract contract JBControllerUtility is IJBControllerUtility { //*********************************************************************// // --------------------------- custom errors -------------------------- // //*********************************************************************// error CONTROLLER_UNAUTHORIZED(); //*********************************************************************// // ---------------------------- modifiers ---------------------------- // //*********************************************************************// /** @notice Only allows the controller of the specified project to proceed. @param _projectId The ID of the project. */ modifier onlyController(uint256 _projectId) { if (address(directory.controllerOf(_projectId)) != msg.sender) revert CONTROLLER_UNAUTHORIZED(); _; } //*********************************************************************// // ---------------- public immutable stored properties --------------- // //*********************************************************************// /** @notice The directory of terminals and controllers for projects. */ IJBDirectory public immutable override directory; //*********************************************************************// // -------------------------- constructor ---------------------------- // //*********************************************************************// /** @param _directory A contract storing directories of terminals and controllers for each project. */ constructor(IJBDirectory _directory) { directory = _directory; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import './../interfaces/IJBOperatable.sol'; /** @notice Modifiers to allow access to functions based on the message sender's operator status. @dev Adheres to - IJBOperatable: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules. */ abstract contract JBOperatable is IJBOperatable { //*********************************************************************// // --------------------------- custom errors -------------------------- // //*********************************************************************// error UNAUTHORIZED(); //*********************************************************************// // ---------------------------- modifiers ---------------------------- // //*********************************************************************// /** @notice Only allows the speficied account or an operator of the account to proceed. @param _account The account to check for. @param _domain The domain namespace to look for an operator within. @param _permissionIndex The index of the permission to check for. */ modifier requirePermission( address _account, uint256 _domain, uint256 _permissionIndex ) { _requirePermission(_account, _domain, _permissionIndex); _; } /** @notice Only allows the speficied account, an operator of the account to proceed, or a truthy override flag. @param _account The account to check for. @param _domain The domain namespace to look for an operator within. @param _permissionIndex The index of the permission to check for. @param _override A condition to force allowance for. */ modifier requirePermissionAllowingOverride( address _account, uint256 _domain, uint256 _permissionIndex, bool _override ) { _requirePermissionAllowingOverride(_account, _domain, _permissionIndex, _override); _; } //*********************************************************************// // ---------------- public immutable stored properties --------------- // //*********************************************************************// /** @notice A contract storing operator assignments. */ IJBOperatorStore public immutable override operatorStore; //*********************************************************************// // -------------------------- constructor ---------------------------- // //*********************************************************************// /** @param _operatorStore A contract storing operator assignments. */ constructor(IJBOperatorStore _operatorStore) { operatorStore = _operatorStore; } //*********************************************************************// // -------------------------- internal views ------------------------- // //*********************************************************************// /** @notice Require the message sender is either the account or has the specified permission. @param _account The account to allow. @param _domain The domain namespace within which the permission index will be checked. @param _permissionIndex The permission index that an operator must have within the specified domain to be allowed. */ function _requirePermission( address _account, uint256 _domain, uint256 _permissionIndex ) internal view { if ( msg.sender != _account && !operatorStore.hasPermission(msg.sender, _account, _domain, _permissionIndex) && !operatorStore.hasPermission(msg.sender, _account, 0, _permissionIndex) ) revert UNAUTHORIZED(); } /** @notice Require the message sender is either the account, has the specified permission, or the override condition is true. @param _account The account to allow. @param _domain The domain namespace within which the permission index will be checked. @param _domain The permission index that an operator must have within the specified domain to be allowed. @param _override The override condition to allow. */ function _requirePermissionAllowingOverride( address _account, uint256 _domain, uint256 _permissionIndex, bool _override ) internal view { if ( !_override && msg.sender != _account && !operatorStore.hasPermission(msg.sender, _account, _domain, _permissionIndex) && !operatorStore.hasPermission(msg.sender, _account, 0, _permissionIndex) ) revert UNAUTHORIZED(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; enum JBBallotState { Active, Approved, Failed }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './IJBDirectory.sol'; interface IJBControllerUtility { function directory() external view returns (IJBDirectory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './IJBFundingCycleStore.sol'; import './IJBPaymentTerminal.sol'; import './IJBProjects.sol'; interface IJBDirectory { event SetController(uint256 indexed projectId, address indexed controller, address caller); event AddTerminal(uint256 indexed projectId, IJBPaymentTerminal indexed terminal, address caller); event SetTerminals(uint256 indexed projectId, IJBPaymentTerminal[] terminals, address caller); event SetPrimaryTerminal( uint256 indexed projectId, address indexed token, IJBPaymentTerminal indexed terminal, address caller ); event SetIsAllowedToSetFirstController(address indexed addr, bool indexed flag, address caller); function projects() external view returns (IJBProjects); function fundingCycleStore() external view returns (IJBFundingCycleStore); function controllerOf(uint256 _projectId) external view returns (address); function isAllowedToSetFirstController(address _address) external view returns (bool); function terminalsOf(uint256 _projectId) external view returns (IJBPaymentTerminal[] memory); function isTerminalOf(uint256 _projectId, IJBPaymentTerminal _terminal) external view returns (bool); function primaryTerminalOf(uint256 _projectId, address _token) external view returns (IJBPaymentTerminal); function setControllerOf(uint256 _projectId, address _controller) external; function setTerminalsOf(uint256 _projectId, IJBPaymentTerminal[] calldata _terminals) external; function setPrimaryTerminalOf( uint256 _projectId, address _token, IJBPaymentTerminal _terminal ) external; function setIsAllowedToSetFirstController(address _address, bool _flag) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; import './../enums/JBBallotState.sol'; interface IJBFundingCycleBallot is IERC165 { function duration() external view returns (uint256); function stateOf( uint256 _projectId, uint256 _configuration, uint256 _start ) external view returns (JBBallotState); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../enums/JBBallotState.sol'; import './../structs/JBFundingCycle.sol'; import './../structs/JBFundingCycleData.sol'; interface IJBFundingCycleStore { event Configure( uint256 indexed configuration, uint256 indexed projectId, JBFundingCycleData data, uint256 metadata, uint256 mustStartAtOrAfter, address caller ); event Init(uint256 indexed configuration, uint256 indexed projectId, uint256 indexed basedOn); function latestConfigurationOf(uint256 _projectId) external view returns (uint256); function get(uint256 _projectId, uint256 _configuration) external view returns (JBFundingCycle memory); function latestConfiguredOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle, JBBallotState ballotState); function queuedOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle); function currentOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle); function currentBallotStateOf(uint256 _projectId) external view returns (JBBallotState); function configureFor( uint256 _projectId, JBFundingCycleData calldata _data, uint256 _metadata, uint256 _mustStartAtOrAfter ) external returns (JBFundingCycle memory fundingCycle); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './IJBOperatorStore.sol'; interface IJBOperatable { function operatorStore() external view returns (IJBOperatorStore); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../structs/JBOperatorData.sol'; interface IJBOperatorStore { event SetOperator( address indexed operator, address indexed account, uint256 indexed domain, uint256[] permissionIndexes, uint256 packed ); function permissionsOf( address _operator, address _account, uint256 _domain ) external view returns (uint256); function hasPermission( address _operator, address _account, uint256 _domain, uint256 _permissionIndex ) external view returns (bool); function hasPermissions( address _operator, address _account, uint256 _domain, uint256[] calldata _permissionIndexes ) external view returns (bool); function setOperator(JBOperatorData calldata _operatorData) external; function setOperators(JBOperatorData[] calldata _operatorData) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/utils/introspection/IERC165.sol'; interface IJBPaymentTerminal is IERC165 { function acceptsToken(address _token, uint256 _projectId) external view returns (bool); function currencyForToken(address _token) external view returns (uint256); function decimalsForToken(address _token) external view returns (uint256); // Return value must be a fixed point number with 18 decimals. function currentEthOverflowOf(uint256 _projectId) external view returns (uint256); function pay( uint256 _projectId, uint256 _amount, address _token, address _beneficiary, uint256 _minReturnedTokens, bool _preferClaimedTokens, string calldata _memo, bytes calldata _metadata ) external payable returns (uint256 beneficiaryTokenCount); function addToBalanceOf( uint256 _projectId, uint256 _amount, address _token, string calldata _memo, bytes calldata _metadata ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import './../structs/JBProjectMetadata.sol'; import './IJBTokenUriResolver.sol'; interface IJBProjects is IERC721 { event Create( uint256 indexed projectId, address indexed owner, JBProjectMetadata metadata, address caller ); event SetMetadata(uint256 indexed projectId, JBProjectMetadata metadata, address caller); event SetTokenUriResolver(IJBTokenUriResolver indexed resolver, address caller); function count() external view returns (uint256); function metadataContentOf(uint256 _projectId, uint256 _domain) external view returns (string memory); function tokenUriResolver() external view returns (IJBTokenUriResolver); function createFor(address _owner, JBProjectMetadata calldata _metadata) external returns (uint256 projectId); function setMetadataOf(uint256 _projectId, JBProjectMetadata calldata _metadata) external; function setTokenUriResolver(IJBTokenUriResolver _newResolver) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IJBToken { function projectId() external view returns (uint256); function decimals() external view returns (uint8); function totalSupply(uint256 _projectId) external view returns (uint256); function balanceOf(address _account, uint256 _projectId) external view returns (uint256); function mint( uint256 _projectId, address _account, uint256 _amount ) external; function burn( uint256 _projectId, address _account, uint256 _amount ) external; function approve( uint256, address _spender, uint256 _amount ) external; function transfer( uint256 _projectId, address _to, uint256 _amount ) external; function transferFrom( uint256 _projectId, address _from, address _to, uint256 _amount ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './IJBFundingCycleStore.sol'; import './IJBProjects.sol'; import './IJBToken.sol'; interface IJBTokenStore { event Issue( uint256 indexed projectId, IJBToken indexed token, string name, string symbol, address caller ); event Mint( address indexed holder, uint256 indexed projectId, uint256 amount, bool tokensWereClaimed, bool preferClaimedTokens, address caller ); event Burn( address indexed holder, uint256 indexed projectId, uint256 amount, uint256 initialUnclaimedBalance, uint256 initialClaimedBalance, bool preferClaimedTokens, address caller ); event Claim( address indexed holder, uint256 indexed projectId, uint256 initialUnclaimedBalance, uint256 amount, address caller ); event Set(uint256 indexed projectId, IJBToken indexed newToken, address caller); event Transfer( address indexed holder, uint256 indexed projectId, address indexed recipient, uint256 amount, address caller ); function tokenOf(uint256 _projectId) external view returns (IJBToken); function projects() external view returns (IJBProjects); function fundingCycleStore() external view returns (IJBFundingCycleStore); function unclaimedBalanceOf(address _holder, uint256 _projectId) external view returns (uint256); function unclaimedTotalSupplyOf(uint256 _projectId) external view returns (uint256); function totalSupplyOf(uint256 _projectId) external view returns (uint256); function balanceOf(address _holder, uint256 _projectId) external view returns (uint256 _result); function issueFor( uint256 _projectId, string calldata _name, string calldata _symbol ) external returns (IJBToken token); function setFor(uint256 _projectId, IJBToken _token) external; function burnFrom( address _holder, uint256 _projectId, uint256 _amount, bool _preferClaimedTokens ) external; function mintFor( address _holder, uint256 _projectId, uint256 _amount, bool _preferClaimedTokens ) external; function claimFor( address _holder, uint256 _projectId, uint256 _amount ) external; function transferFrom( address _holder, uint256 _projectId, address _recipient, uint256 _amount ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IJBTokenUriResolver { function getUri(uint256 _projectId) external view returns (string memory tokenUri); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** @notice Global constants used across Juicebox contracts. */ library JBConstants { uint256 public constant MAX_RESERVED_RATE = 10_000; uint256 public constant MAX_REDEMPTION_RATE = 10_000; uint256 public constant MAX_DISCOUNT_RATE = 1_000_000_000; uint256 public constant SPLITS_TOTAL_PERCENT = 1_000_000_000; uint256 public constant MAX_FEE = 1_000_000_000; uint256 public constant MAX_FEE_DISCOUNT = 1_000_000_000; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import './../structs/JBFundingCycle.sol'; import './../structs/JBFundingCycleMetadata.sol'; import './../structs/JBGlobalFundingCycleMetadata.sol'; import './JBConstants.sol'; import './JBGlobalFundingCycleMetadataResolver.sol'; library JBFundingCycleMetadataResolver { function global(JBFundingCycle memory _fundingCycle) internal pure returns (JBGlobalFundingCycleMetadata memory) { return JBGlobalFundingCycleMetadataResolver.expandMetadata(uint8(_fundingCycle.metadata >> 8)); } function reservedRate(JBFundingCycle memory _fundingCycle) internal pure returns (uint256) { return uint256(uint16(_fundingCycle.metadata >> 24)); } function redemptionRate(JBFundingCycle memory _fundingCycle) internal pure returns (uint256) { // Redemption rate is a number 0-10000. It's inverse was stored so the most common case of 100% results in no storage needs. return JBConstants.MAX_REDEMPTION_RATE - uint256(uint16(_fundingCycle.metadata >> 40)); } function ballotRedemptionRate(JBFundingCycle memory _fundingCycle) internal pure returns (uint256) { // Redemption rate is a number 0-10000. It's inverse was stored so the most common case of 100% results in no storage needs. return JBConstants.MAX_REDEMPTION_RATE - uint256(uint16(_fundingCycle.metadata >> 56)); } function payPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 72) & 1) == 1; } function distributionsPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 73) & 1) == 1; } function redeemPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 74) & 1) == 1; } function burnPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 75) & 1) == 1; } function mintingAllowed(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 76) & 1) == 1; } function terminalMigrationAllowed(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 77) & 1) == 1; } function controllerMigrationAllowed(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 78) & 1) == 1; } function shouldHoldFees(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 79) & 1) == 1; } function preferClaimedTokenOverride(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 80) & 1) == 1; } function useTotalOverflowForRedemptions(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return ((_fundingCycle.metadata >> 81) & 1) == 1; } function useDataSourceForPay(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return (_fundingCycle.metadata >> 82) & 1 == 1; } function useDataSourceForRedeem(JBFundingCycle memory _fundingCycle) internal pure returns (bool) { return (_fundingCycle.metadata >> 83) & 1 == 1; } function dataSource(JBFundingCycle memory _fundingCycle) internal pure returns (address) { return address(uint160(_fundingCycle.metadata >> 84)); } function metadata(JBFundingCycle memory _fundingCycle) internal pure returns (uint256) { return uint256(uint8(_fundingCycle.metadata >> 244)); } /** @notice Pack the funding cycle metadata. @param _metadata The metadata to validate and pack. @return packed The packed uint256 of all metadata params. The first 8 bits specify the version. */ function packFundingCycleMetadata(JBFundingCycleMetadata memory _metadata) internal pure returns (uint256 packed) { // version 1 in the bits 0-7 (8 bits). packed = 1; // global metadta in bits 8-23 (16 bits). packed |= JBGlobalFundingCycleMetadataResolver.packFundingCycleGlobalMetadata(_metadata.global) << 8; // reserved rate in bits 24-39 (16 bits). packed |= _metadata.reservedRate << 24; // redemption rate in bits 40-55 (16 bits). // redemption rate is a number 0-10000. Store the reverse so the most common case of 100% results in no storage needs. packed |= (JBConstants.MAX_REDEMPTION_RATE - _metadata.redemptionRate) << 40; // ballot redemption rate rate in bits 56-71 (16 bits). // ballot redemption rate is a number 0-10000. Store the reverse so the most common case of 100% results in no storage needs. packed |= (JBConstants.MAX_REDEMPTION_RATE - _metadata.ballotRedemptionRate) << 56; // pause pay in bit 72. if (_metadata.pausePay) packed |= 1 << 72; // pause tap in bit 73. if (_metadata.pauseDistributions) packed |= 1 << 73; // pause redeem in bit 74. if (_metadata.pauseRedeem) packed |= 1 << 74; // pause burn in bit 75. if (_metadata.pauseBurn) packed |= 1 << 75; // allow minting in bit 76. if (_metadata.allowMinting) packed |= 1 << 76; // allow terminal migration in bit 77. if (_metadata.allowTerminalMigration) packed |= 1 << 77; // allow controller migration in bit 78. if (_metadata.allowControllerMigration) packed |= 1 << 78; // hold fees in bit 79. if (_metadata.holdFees) packed |= 1 << 79; // prefer claimed token override in bit 80. if (_metadata.preferClaimedTokenOverride) packed |= 1 << 80; // useTotalOverflowForRedemptions in bit 81. if (_metadata.useTotalOverflowForRedemptions) packed |= 1 << 81; // use pay data source in bit 82. if (_metadata.useDataSourceForPay) packed |= 1 << 82; // use redeem data source in bit 83. if (_metadata.useDataSourceForRedeem) packed |= 1 << 83; // data source address in bits 84-243. packed |= uint256(uint160(address(_metadata.dataSource))) << 84; // metadata in bits 244-252 (8 bits). packed |= _metadata.metadata << 244; } /** @notice Expand the funding cycle metadata. @param _fundingCycle The funding cycle having its metadata expanded. @return metadata The metadata object. */ function expandMetadata(JBFundingCycle memory _fundingCycle) internal pure returns (JBFundingCycleMetadata memory) { return JBFundingCycleMetadata( global(_fundingCycle), reservedRate(_fundingCycle), redemptionRate(_fundingCycle), ballotRedemptionRate(_fundingCycle), payPaused(_fundingCycle), distributionsPaused(_fundingCycle), redeemPaused(_fundingCycle), burnPaused(_fundingCycle), mintingAllowed(_fundingCycle), terminalMigrationAllowed(_fundingCycle), controllerMigrationAllowed(_fundingCycle), shouldHoldFees(_fundingCycle), preferClaimedTokenOverride(_fundingCycle), useTotalOverflowForRedemptions(_fundingCycle), useDataSourceForPay(_fundingCycle), useDataSourceForRedeem(_fundingCycle), dataSource(_fundingCycle), metadata(_fundingCycle) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.16; import './../structs/JBFundingCycleMetadata.sol'; library JBGlobalFundingCycleMetadataResolver { function setTerminalsAllowed(uint8 _data) internal pure returns (bool) { return (_data & 1) == 1; } function setControllerAllowed(uint8 _data) internal pure returns (bool) { return ((_data >> 1) & 1) == 1; } function transfersPaused(uint8 _data) internal pure returns (bool) { return ((_data >> 2) & 1) == 1; } /** @notice Pack the global funding cycle metadata. @param _metadata The metadata to validate and pack. @return packed The packed uint256 of all global metadata params. The first 8 bits specify the version. */ function packFundingCycleGlobalMetadata(JBGlobalFundingCycleMetadata memory _metadata) internal pure returns (uint256 packed) { // allow set terminals in bit 0. if (_metadata.allowSetTerminals) packed |= 1; // allow set controller in bit 1. if (_metadata.allowSetController) packed |= 1 << 1; // pause transfers in bit 2. if (_metadata.pauseTransfers) packed |= 1 << 2; } /** @notice Expand the global funding cycle metadata. @param _packedMetadata The packed metadata to expand. @return metadata The global metadata object. */ function expandMetadata(uint8 _packedMetadata) internal pure returns (JBGlobalFundingCycleMetadata memory metadata) { return JBGlobalFundingCycleMetadata( setTerminalsAllowed(_packedMetadata), setControllerAllowed(_packedMetadata), transfersPaused(_packedMetadata) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library JBOperations { uint256 public constant RECONFIGURE = 1; uint256 public constant REDEEM = 2; uint256 public constant MIGRATE_CONTROLLER = 3; uint256 public constant MIGRATE_TERMINAL = 4; uint256 public constant PROCESS_FEES = 5; uint256 public constant SET_METADATA = 6; uint256 public constant ISSUE = 7; uint256 public constant SET_TOKEN = 8; uint256 public constant MINT = 9; uint256 public constant BURN = 10; uint256 public constant CLAIM = 11; uint256 public constant TRANSFER = 12; uint256 public constant REQUIRE_CLAIM = 13; // unused in v3 uint256 public constant SET_CONTROLLER = 14; uint256 public constant SET_TERMINALS = 15; uint256 public constant SET_PRIMARY_TERMINAL = 16; uint256 public constant USE_ALLOWANCE = 17; uint256 public constant SET_SPLITS = 18; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../interfaces/IJBFundingCycleBallot.sol'; /** @member number The funding cycle number for the cycle's project. Each funding cycle has a number that is an increment of the cycle that directly preceded it. Each project's first funding cycle has a number of 1. @member configuration The timestamp when the parameters for this funding cycle were configured. This value will stay the same for subsequent funding cycles that roll over from an originally configured cycle. @member basedOn The `configuration` of the funding cycle that was active when this cycle was created. @member start The timestamp marking the moment from which the funding cycle is considered active. It is a unix timestamp measured in seconds. @member duration The number of seconds the funding cycle lasts for, after which a new funding cycle will start. A duration of 0 means that the funding cycle will stay active until the project owner explicitly issues a reconfiguration, at which point a new funding cycle will immediately start with the updated properties. If the duration is greater than 0, a project owner cannot make changes to a funding cycle's parameters while it is active – any proposed changes will apply to the subsequent cycle. If no changes are proposed, a funding cycle rolls over to another one with the same properties but new `start` timestamp and a discounted `weight`. @member weight A fixed point number with 18 decimals that contracts can use to base arbitrary calculations on. For example, payment terminals can use this to determine how many tokens should be minted when a payment is received. @member discountRate A percent by how much the `weight` of the subsequent funding cycle should be reduced, if the project owner hasn't configured the subsequent funding cycle with an explicit `weight`. If it's 0, each funding cycle will have equal weight. If the number is 90%, the next funding cycle will have a 10% smaller weight. This weight is out of `JBConstants.MAX_DISCOUNT_RATE`. @member ballot An address of a contract that says whether a proposed reconfiguration should be accepted or rejected. It can be used to create rules around how a project owner can change funding cycle parameters over time. @member metadata Extra data that can be associated with a funding cycle. */ struct JBFundingCycle { uint256 number; uint256 configuration; uint256 basedOn; uint256 start; uint256 duration; uint256 weight; uint256 discountRate; IJBFundingCycleBallot ballot; uint256 metadata; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './../interfaces/IJBFundingCycleBallot.sol'; /** @member duration The number of seconds the funding cycle lasts for, after which a new funding cycle will start. A duration of 0 means that the funding cycle will stay active until the project owner explicitly issues a reconfiguration, at which point a new funding cycle will immediately start with the updated properties. If the duration is greater than 0, a project owner cannot make changes to a funding cycle's parameters while it is active – any proposed changes will apply to the subsequent cycle. If no changes are proposed, a funding cycle rolls over to another one with the same properties but new `start` timestamp and a discounted `weight`. @member weight A fixed point number with 18 decimals that contracts can use to base arbitrary calculations on. For example, payment terminals can use this to determine how many tokens should be minted when a payment is received. @member discountRate A percent by how much the `weight` of the subsequent funding cycle should be reduced, if the project owner hasn't configured the subsequent funding cycle with an explicit `weight`. If it's 0, each funding cycle will have equal weight. If the number is 90%, the next funding cycle will have a 10% smaller weight. This weight is out of `JBConstants.MAX_DISCOUNT_RATE`. @member ballot An address of a contract that says whether a proposed reconfiguration should be accepted or rejected. It can be used to create rules around how a project owner can change funding cycle parameters over time. */ struct JBFundingCycleData { uint256 duration; uint256 weight; uint256 discountRate; IJBFundingCycleBallot ballot; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './JBGlobalFundingCycleMetadata.sol'; /** @member global Data used globally in non-migratable ecosystem contracts. @member reservedRate The reserved rate of the funding cycle. This number is a percentage calculated out of `JBConstants.MAX_RESERVED_RATE`. @member redemptionRate The redemption rate of the funding cycle. This number is a percentage calculated out of `JBConstants.MAX_REDEMPTION_RATE`. @member ballotRedemptionRate The redemption rate to use during an active ballot of the funding cycle. This number is a percentage calculated out of `JBConstants.MAX_REDEMPTION_RATE`. @member pausePay A flag indicating if the pay functionality should be paused during the funding cycle. @member pauseDistributions A flag indicating if the distribute functionality should be paused during the funding cycle. @member pauseRedeem A flag indicating if the redeem functionality should be paused during the funding cycle. @member pauseBurn A flag indicating if the burn functionality should be paused during the funding cycle. @member allowMinting A flag indicating if minting tokens should be allowed during this funding cycle. @member allowTerminalMigration A flag indicating if migrating terminals should be allowed during this funding cycle. @member allowControllerMigration A flag indicating if migrating controllers should be allowed during this funding cycle. @member holdFees A flag indicating if fees should be held during this funding cycle. @member preferClaimedTokenOverride A flag indicating if claimed tokens should always be prefered to unclaimed tokens when minting. @member useTotalOverflowForRedemptions A flag indicating if redemptions should use the project's balance held in all terminals instead of the project's local terminal balance from which the redemption is being fulfilled. @member useDataSourceForPay A flag indicating if the data source should be used for pay transactions during this funding cycle. @member useDataSourceForRedeem A flag indicating if the data source should be used for redeem transactions during this funding cycle. @member dataSource The data source to use during this funding cycle. @member metadata Metadata of the metadata, up to uint8 in size. */ struct JBFundingCycleMetadata { JBGlobalFundingCycleMetadata global; uint256 reservedRate; uint256 redemptionRate; uint256 ballotRedemptionRate; bool pausePay; bool pauseDistributions; bool pauseRedeem; bool pauseBurn; bool allowMinting; bool allowTerminalMigration; bool allowControllerMigration; bool holdFees; bool preferClaimedTokenOverride; bool useTotalOverflowForRedemptions; bool useDataSourceForPay; bool useDataSourceForRedeem; address dataSource; uint256 metadata; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** @member allowSetTerminals A flag indicating if setting terminals should be allowed during this funding cycle. @member allowSetController A flag indicating if setting a new controller should be allowed during this funding cycle. @member pauseTransfers A flag indicating if the project token transfer functionality should be paused during the funding cycle. */ struct JBGlobalFundingCycleMetadata { bool allowSetTerminals; bool allowSetController; bool pauseTransfers; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** @member operator The address of the operator. @member domain The domain within which the operator is being given permissions. A domain of 0 is a wildcard domain, which gives an operator access to all domains. @member permissionIndexes The indexes of the permissions the operator is being given. */ struct JBOperatorData { address operator; uint256 domain; uint256[] permissionIndexes; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** @member content The metadata content. @member domain The domain within which the metadata applies. */ struct JBProjectMetadata { string content; uint256 domain; }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 10000 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IJBOperatorStore","name":"_operatorStore","type":"address"},{"internalType":"contract IJBProjects","name":"_projects","type":"address"},{"internalType":"contract IJBDirectory","name":"_directory","type":"address"},{"internalType":"contract IJBFundingCycleStore","name":"_fundingCycleStore","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ALREADY_SET","type":"error"},{"inputs":[],"name":"CONTROLLER_UNAUTHORIZED","type":"error"},{"inputs":[],"name":"EMPTY_NAME","type":"error"},{"inputs":[],"name":"EMPTY_SYMBOL","type":"error"},{"inputs":[],"name":"EMPTY_TOKEN","type":"error"},{"inputs":[],"name":"INSUFFICIENT_FUNDS","type":"error"},{"inputs":[],"name":"INSUFFICIENT_UNCLAIMED_TOKENS","type":"error"},{"inputs":[],"name":"OVERFLOW_ALERT","type":"error"},{"inputs":[],"name":"PROJECT_ALREADY_HAS_TOKEN","type":"error"},{"inputs":[],"name":"RECIPIENT_ZERO_ADDRESS","type":"error"},{"inputs":[],"name":"TOKENS_MUST_HAVE_18_DECIMALS","type":"error"},{"inputs":[],"name":"TOKEN_NOT_FOUND","type":"error"},{"inputs":[],"name":"TRANSFERS_PAUSED","type":"error"},{"inputs":[],"name":"UNAUTHORIZED","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"initialUnclaimedBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"initialClaimedBalance","type":"uint256"},{"indexed":false,"internalType":"bool","name":"preferClaimedTokens","type":"bool"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"initialUnclaimedBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":true,"internalType":"contract IJBToken","name":"token","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"tokensWereClaimed","type":"bool"},{"indexed":false,"internalType":"bool","name":"preferClaimedTokens","type":"bool"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":true,"internalType":"contract IJBToken","name":"newToken","type":"address"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"Set","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"holder","type":"address"},{"indexed":true,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"caller","type":"address"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_projectId","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_preferClaimedTokens","type":"bool"}],"name":"burnFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"claimFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"directory","outputs":[{"internalType":"contract IJBDirectory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundingCycleStore","outputs":[{"internalType":"contract IJBFundingCycleStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"name":"issueFor","outputs":[{"internalType":"contract IJBToken","name":"token","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_preferClaimedTokens","type":"bool"}],"name":"mintFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"operatorStore","outputs":[{"internalType":"contract IJBOperatorStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projects","outputs":[{"internalType":"contract IJBProjects","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"contract IJBToken","name":"_token","type":"address"}],"name":"setFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenOf","outputs":[{"internalType":"contract IJBToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"}],"name":"totalSupplyOf","outputs":[{"internalType":"uint256","name":"totalSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_holder","type":"address"},{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"address","name":"_recipient","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"unclaimedBalanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"unclaimedTotalSupplyOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101006040523480156200001257600080fd5b5060405162004c3238038062004c32833981016040819052620000359162000072565b6001600160a01b0391821660805292811660a05290811660c0521660e052620000da565b6001600160a01b03811681146200006f57600080fd5b50565b600080600080608085870312156200008957600080fd5b8451620000968162000059565b6020860151909450620000a98162000059565b6040860151909350620000bc8162000059565b6060860151909250620000cf8162000059565b939692955090935050565b60805160a05160c05160e051614aed620001456000396000818161018e0152611080015260008181610223015281816107270152610df0015260008181610290015281816116a501526117760152600081816102b8015281816109e601526113240152614aed6000f3fe60806040523480156200001157600080fd5b5060043610620001085760003560e01c80638b79543c11620000a3578063ad007d63116200006e578063ad007d63146200028a578063c41c2f2414620002b2578063ceddd3e414620002da578063ea78803f14620002f157600080fd5b80638b79543c146200021d578063906ebd0f1462000245578063a7f2a70b146200025c578063ac689bcd146200027357600080fd5b8063557e715511620000e4578063557e715514620001885780636607955d14620001d657806375b0d9cd14620001ef578063831d7fac146200020657600080fd5b8062fdd58e146200010d5780631412884f14620001375780635287af37146200015a575b600080fd5b620001246200011e366004620018d2565b6200032a565b6040519081526020015b60405180910390f35b620001246200014836600462001901565b60016020526000908152604090205481565b620001246200016b366004620018d2565b600260209081526000928352604080842090915290825290205481565b620001b07f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016200012e565b620001ed620001e73660046200191b565b6200041c565b005b620001246200020036600462001901565b6200061a565b620001ed6200021736600462001953565b620006f8565b620001b07f000000000000000000000000000000000000000000000000000000000000000081565b620001ed6200025636600462001995565b6200099e565b620001b06200026d36600462001a30565b62000dbe565b620001ed6200028436600462001ab1565b6200103d565b620001b07f000000000000000000000000000000000000000000000000000000000000000081565b620001b07f000000000000000000000000000000000000000000000000000000000000000081565b620001ed620002eb36600462001995565b620012dc565b620001b06200030236600462001901565b60006020819052908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526002602090815260408083208584528252808320549183905290912054909116801562000415576040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301526024820185905282169062fdd58e90604401602060405180830381865afa158015620003e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000406919062001afe565b62000412908362001b47565b91505b5092915050565b8282600b6200042d8383836200162a565b60008581526020819052604090205473ffffffffffffffffffffffffffffffffffffffff16806200048a576040517f73c463ce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8716600090815260026020908152604080832089845290915290205485811015620004f6576040517f83fc8b2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff88811660008181526002602090815260408083208c845282528083208b8703905560019091529081902080548a90039055517f836a1040000000000000000000000000000000000000000000000000000000008152600481018a90526024810191909152604481018890529083169063836a104090606401600060405180830381600087803b1580156200059e57600080fd5b505af1158015620005b3573d6000803e3d6000fd5b505060408051848152602081018a9052338183015290518a935073ffffffffffffffffffffffffffffffffffffffff8c1692507fe718784128df3c3d45fbd6519133fee450494f7cdb2b53830a5087cd47f980829181900360600190a35050505050505050565b600081815260016020908152604080832054918390529091205473ffffffffffffffffffffffffffffffffffffffff168015620006f2576040517fbd85b0390000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff82169063bd85b03990602401602060405180830381865afa158015620006bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006e3919062001afe565b620006ef908362001b47565b91505b50919050565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa15801562000784573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007aa919062001b5d565b826008620007ba8383836200162a565b73ffffffffffffffffffffffffffffffffffffffff841662000808576040517f24679e7b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526020819052604090205473ffffffffffffffffffffffffffffffffffffffff161562000865576040517f97f9d95700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620008b1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620008d7919062001b84565b60ff1660121462000914576040517fadc38c9400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000858152602081815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8816908117909155915133815287917ff2b3bb02e24e3ecd8d6fbce63d308207ce06307b9f7ba575bef710e1e70ac60e910160405180910390a35050505050565b6040517f5dd8f6aa000000000000000000000000000000000000000000000000000000008152600481018490528390339073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690635dd8f6aa90602401602060405180830381865afa15801562000a2e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a54919062001b5d565b73ffffffffffffffffffffffffffffffffffffffff161462000aa2576040517fab7f741400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152602081815260408083205473ffffffffffffffffffffffffffffffffffffffff89811685526002845282852089865290935290832054911691821562000b85576040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301526024820189905284169062fdd58e90604401602060405180830381865afa15801562000b59573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b7f919062001afe565b62000b88565b60005b905062000b96828262001b47565b86111562000bd0576040517fe793143800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811562000c1057851562000bf95786821062000bef578662000bf1565b815b905062000c10565b86831062000c0957600062000c0d565b8287035b90505b80870387821462000cb05773ffffffffffffffffffffffffffffffffffffffff8a1660009081526002602090815260408083208c845290915290205462000c5990829062001ba9565b73ffffffffffffffffffffffffffffffffffffffff8b1660009081526002602090815260408083208d845282528083209390935560019052205462000ca090829062001ba9565b60008a8152600160205260409020555b811562000d49576040517f9eea5f66000000000000000000000000000000000000000000000000000000008152600481018a905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015260448201849052861690639eea5f6690606401600060405180830381600087803b15801562000d2f57600080fd5b505af115801562000d44573d6000803e3d6000fd5b505050505b60408051898152602081018690529081018490528715156060820152336080820152899073ffffffffffffffffffffffffffffffffffffffff8c16907fbe100da6adaa492f7ba1b0de916ae2606126ec7b044d7aa8ec74971a607ceecd9060a00160405180910390a350505050505050505050565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018690526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa15801562000e4d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e73919062001b5d565b86600762000e838383836200162a565b600087900362000ebf576040517f92bf449d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600085900362000efb576040517f571431a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008981526020819052604090205473ffffffffffffffffffffffffffffffffffffffff161562000f58576040517fa54630ac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b878787878c60405162000f6b906200189e565b62000f7b95949392919062001c08565b604051809103906000f08015801562000f98573d6000803e3d6000fd5b5060008a8152602081905260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091559051919550908a907f1b1705bef26552c8f314c5eb80e9c84f02876c2f7f30a7f9ad5cafd17d5fa6da9062001029908c908c908c908c90339062001c46565b60405180910390a350505095945050505050565b8383600c6200104e8383836200162a565b6040517f43a266c2000000000000000000000000000000000000000000000000000000008152600481018790526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906343a266c29060240161012060405180830381865afa158015620010de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001104919062001cfe565b9050620011118162001823565b60400151156200114d576040517f18cdaf9700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff86166200119b576040517fc6587bab00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff881660009081526002602090815260408083208a84529091529020548086111562001207576040517f83fc8b2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808a1660009081526002602081815260408084208d855282528084208b87039055938b1683529081528282208b8352905220546200125c90879062001b47565b73ffffffffffffffffffffffffffffffffffffffff88811660008181526002602090815260408083208e84528252918290209490945580518a8152339481019490945290928b928d16917fae47e55abe3902569528abe4272b889079230a248aec0659a2939a90354982c6910160405180910390a4505050505050505050565b6040517f5dd8f6aa000000000000000000000000000000000000000000000000000000008152600481018490528390339073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690635dd8f6aa90602401602060405180830381865afa1580156200136c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001392919062001b5d565b73ffffffffffffffffffffffffffffffffffffffff1614620013e0576040517fab7f741400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526020819052604081205473ffffffffffffffffffffffffffffffffffffffff169083801562001429575073ffffffffffffffffffffffffffffffffffffffff821615155b90508015620014c9576040517f836a10400000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff88811660248301526044820187905283169063836a104090606401600060405180830381600087803b158015620014aa57600080fd5b505af1158015620014bf573d6000803e3d6000fd5b505050506200155e565b73ffffffffffffffffffffffffffffffffffffffff871660009081526002602090815260408083208984529091529020546200150790869062001b47565b73ffffffffffffffffffffffffffffffffffffffff881660009081526002602090815260408083208a84528252808320939093556001905220546200154e90869062001b47565b6000878152600160205260409020555b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff62001586876200061a565b1115620015bf576040517f60c5e71200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518681528215156020820152851515818301523360608201529051879173ffffffffffffffffffffffffffffffffffffffff8a16917f5dd3ead325af435e56bc762b40de54c96de6071938d18a26414245807591d86f9181900360800190a350505050505050565b3373ffffffffffffffffffffffffffffffffffffffff8416148015906200171557506040517fc161c93f00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff848116602483015260448201849052606482018390527f0000000000000000000000000000000000000000000000000000000000000000169063c161c93f90608401602060405180830381865afa158015620016ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001713919062001d83565b155b8015620017e657506040517fc161c93f00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff848116602483015260006044830152606482018390527f0000000000000000000000000000000000000000000000000000000000000000169063c161c93f90608401602060405180830381865afa158015620017be573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620017e4919062001d83565b155b156200181e576040517f075fd2b100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6040805160608101825260008082526020820181905291810191909152620018986008836101000151901c604080516060808201835260008083526020808401829052928401528251908101835260018481168114825284811c811681149282019290925260029390931c8116149082015290565b92915050565b612d148062001da483390190565b73ffffffffffffffffffffffffffffffffffffffff81168114620018cf57600080fd5b50565b60008060408385031215620018e657600080fd5b8235620018f381620018ac565b946020939093013593505050565b6000602082840312156200191457600080fd5b5035919050565b6000806000606084860312156200193157600080fd5b83356200193e81620018ac565b95602085013595506040909401359392505050565b600080604083850312156200196757600080fd5b8235915060208301356200197b81620018ac565b809150509250929050565b8015158114620018cf57600080fd5b60008060008060808587031215620019ac57600080fd5b8435620019b981620018ac565b935060208501359250604085013591506060850135620019d98162001986565b939692955090935050565b60008083601f840112620019f757600080fd5b50813567ffffffffffffffff81111562001a1057600080fd5b60208301915083602082850101111562001a2957600080fd5b9250929050565b60008060008060006060868803121562001a4957600080fd5b85359450602086013567ffffffffffffffff8082111562001a6957600080fd5b62001a7789838a01620019e4565b9096509450604088013591508082111562001a9157600080fd5b5062001aa088828901620019e4565b969995985093965092949392505050565b6000806000806080858703121562001ac857600080fd5b843562001ad581620018ac565b935060208501359250604085013562001aee81620018ac565b9396929550929360600135925050565b60006020828403121562001b1157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111562001898576200189862001b18565b60006020828403121562001b7057600080fd5b815162001b7d81620018ac565b9392505050565b60006020828403121562001b9757600080fd5b815160ff8116811462001b7d57600080fd5b8181038181111562001898576200189862001b18565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60608152600062001c1e60608301878962001bbf565b828103602084015262001c3381868862001bbf565b9150508260408301529695505050505050565b60608152600062001c5c60608301878962001bbf565b828103602084015262001c7181868862001bbf565b91505073ffffffffffffffffffffffffffffffffffffffff831660408301529695505050505050565b604051610120810167ffffffffffffffff8111828210171562001ce6577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b805162001cf981620018ac565b919050565b6000610120828403121562001d1257600080fd5b62001d1c62001c9a565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015262001d6a60e0840162001cec565b60e0820152610100928301519281019290925250919050565b60006020828403121562001d9657600080fd5b815162001b7d816200198656fe6101806040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610140523480156200003757600080fd5b5060405162002d1438038062002d148339810160408190526200005a9162000258565b6040805180820190915260018152603160f81b602082015283908190818560036200008683826200035a565b5060046200009582826200035a565b5050825160209384012082519284019290922060e08390526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818901819052818301979097526060810194909452608080850193909352308483018190528151808603909301835260c09485019091528151919096012090529290925261012052506200013490503362000141565b6101605250620004269050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001bb57600080fd5b81516001600160401b0380821115620001d857620001d862000193565b604051601f8301601f19908116603f0116810190828211818310171562000203576200020362000193565b816040528381526020925086838588010111156200022057600080fd5b600091505b8382101562000244578582018301518183018401529082019062000225565b600093810190920192909252949350505050565b6000806000606084860312156200026e57600080fd5b83516001600160401b03808211156200028657600080fd5b6200029487838801620001a9565b94506020860151915080821115620002ab57600080fd5b50620002ba86828701620001a9565b925050604084015190509250925092565b600181811c90821680620002e057607f821691505b6020821081036200030157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200035557600081815260208120601f850160051c81016020861015620003305750805b601f850160051c820191505b8181101562000351578281556001016200033c565b5050505b505050565b81516001600160401b0381111562000376576200037662000193565b6200038e81620003878454620002cb565b8462000307565b602080601f831160018114620003c65760008415620003ad5750858301515b600019600386901b1c1916600185901b17855562000351565b600085815260208120601f198616915b82811015620003f757888601518255948401946001909101908401620003d6565b5085821015620004165787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610120516101405161016051612842620004d2600039600081816102df0152818161061901528181610643015281816109650152818161098f015281816109fa01528181610a2401528181610c0601528181610c3001528181611171015261119b01526000610ee7015260006115fe0152600061164d0152600061162801526000611581015260006115ab015260006115d501526128426000f3fe608060405234801561001057600080fd5b506004361061020a5760003560e01c80637ecebe001161012a578063a457c2d7116100bd578063d505accf1161008c578063f1127ed811610071578063f1127ed8146104d4578063f2fde38b14610526578063f8548e361461053957600080fd5b8063d505accf14610488578063dd62ed3e1461049b57600080fd5b8063a457c2d71461043c578063a9059cbb1461044f578063bd85b03914610462578063c3cda5201461047557600080fd5b80638e539e8c116100f95780638e539e8c146103fb57806395d89b411461040e5780639ab24eb0146104165780639eea5f661461042957600080fd5b80637ecebe00146103b1578063836a1040146103c45780638cb0a511146103d75780638da5cb5b146103ea57600080fd5b806339509351116101a25780635c19a95c116101715780635c19a95c146103455780636fcfff451461035857806370a0823114610380578063715018a6146103a957600080fd5b806339509351146102b45780633a46b1a8146102c75780633fafa127146102da578063587cde1e1461030157600080fd5b80631c0f12b6116101de5780631c0f12b61461027557806323b872dd1461028a578063313ce5671461029d5780633644e515146102ac57600080fd5b8062fdd58e1461020f57806306fdde0314610235578063095ea7b31461024a57806318160ddd1461026d575b600080fd5b61022261021d36600461241c565b61054c565b6040519081526020015b60405180910390f35b61023d61056f565b60405161022c9190612446565b61025d61025836600461241c565b610601565b604051901515815260200161022c565b600254610222565b6102886102833660046124b2565b610617565b005b61025d6102983660046124f6565b6106af565b6040516012815260200161022c565b61022261079d565b61025d6102c236600461241c565b6107a7565b6102226102d536600461241c565b6107e3565b6102227f000000000000000000000000000000000000000000000000000000000000000081565b61032d61030f366004612532565b6001600160a01b039081166000908152600660205260409020541690565b6040516001600160a01b03909116815260200161022c565b610288610353366004612532565b610856565b61036b610366366004612532565b610863565b60405163ffffffff909116815260200161022c565b61022261038e366004612532565b6001600160a01b031660009081526020819052604090205490565b610288610885565b6102226103bf366004612532565b6108eb565b6102886103d236600461254d565b610909565b6102886103e536600461254d565b6109f8565b6009546001600160a01b031661032d565b610222610409366004612572565b610a8e565b61023d610aea565b610222610424366004612532565b610af9565b61028861043736600461254d565b610baa565b61025d61044a36600461241c565b610c94565b61025d61045d36600461241c565b610d45565b610222610470366004612572565b610d52565b61028861048336600461259c565b610d5d565b6102886104963660046125f4565b610e93565b6102226104a936600461265e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6104e76104e2366004612691565b610ff7565b60408051825163ffffffff1681526020928301517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16928101929092520161022c565b610288610534366004612532565b611090565b61028861054736600461254d565b61116f565b6001600160a01b0382166000908152602081905260408120545b90505b92915050565b60606003805461057e906126d1565b80601f01602080910402602001604051908101604052809291908181526020018280546105aa906126d1565b80156105f75780601f106105cc576101008083540402835291602001916105f7565b820191906000526020600020905b8154815290600101906020018083116105da57829003601f168201915b5050505050905090565b600061060e3384846111ff565b50600192915050565b7f00000000000000000000000000000000000000000000000000000000000000001580159061066657507f00000000000000000000000000000000000000000000000000000000000000008414155b1561069d576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106a88383836106af565b5050505050565b6001600160a01b03831660009081526001602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461078257828110156107755760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61078285338584036111ff565b61078d858585611357565b506001949350505050565b905090565b6000610798611574565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161060e9185906107de90869061274d565b6111ff565b60004382106108345760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161076c565b6001600160a01b0383166000908152600760205260409020610566908361169b565b6108603382611782565b50565b6001600160a01b03811660009081526007602052604081205461056990611813565b6009546001600160a01b031633146108df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b6108e96000611893565b565b6001600160a01b038116600090815260056020526040812054610569565b6009546001600160a01b031633146109635760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b7f0000000000000000000000000000000000000000000000000000000000000000158015906109b257507f00000000000000000000000000000000000000000000000000000000000000008314155b156109e9576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f382826118fd565b505050565b7f000000000000000000000000000000000000000000000000000000000000000015801590610a4757507f00000000000000000000000000000000000000000000000000000000000000008314155b15610a7e576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a888282610601565b50505050565b6000438210610adf5760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161076c565b61056960088361169b565b60606004805461057e906126d1565b6001600160a01b0381166000908152600760205260408120548015610b82576001600160a01b0383166000908152600760205260409020610b3b600183612760565b81548110610b4b57610b4b612773565b60009182526020909120015464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610b85565b60005b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169392505050565b6009546001600160a01b03163314610c045760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b7f000000000000000000000000000000000000000000000000000000000000000015801590610c5357507f00000000000000000000000000000000000000000000000000000000000000008314155b15610c8a576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f382826119a9565b3360009081526001602090815260408083206001600160a01b038616845290915281205482811015610d2e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161076c565b610d3b33858584036111ff565b5060019392505050565b600061060e338484611357565b600061056960025490565b83421115610dad5760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e61747572652065787069726564000000604482015260640161076c565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b038816918101919091526060810186905260808101859052600090610e2790610e1f9060a001604051602081830303815290604052805190602001206119c1565b858585611a2a565b9050610e3281611a52565b8614610e805760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e636500000000000000604482015260640161076c565b610e8a8188611782565b50505050505050565b83421115610ee35760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161076c565b60007f0000000000000000000000000000000000000000000000000000000000000000888888610f128c611a52565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610f6d826119c1565b90506000610f7d82878787611a2a565b9050896001600160a01b0316816001600160a01b031614610fe05760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161076c565b610feb8a8a8a6111ff565b50505050505050505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152600760205260409020805463ffffffff841690811061103b5761103b612773565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16918101919091529392505050565b6009546001600160a01b031633146110ea5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b6001600160a01b0381166111665760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161076c565b61086081611893565b7f0000000000000000000000000000000000000000000000000000000000000000158015906111be57507f00000000000000000000000000000000000000000000000000000000000000008314155b156111f5576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a888282610d45565b6001600160a01b03831661127a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0382166112f65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166113d35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b03821661144f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b038316600090815260208190526040902054818110156114de5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061151590849061274d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161156191815260200190565b60405180910390a3610a88848484611a7a565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156115cd57507f000000000000000000000000000000000000000000000000000000000000000046145b156115f757507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8154600090815b818110156116ff5760006116b68284611aac565b9050848682815481106116cb576116cb612773565b60009182526020909120015463ffffffff1611156116eb578092506116f9565b6116f681600161274d565b91505b506116a2565b81156117585784611711600184612760565b8154811061172157611721612773565b60009182526020909120015464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1661175b565b60005b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1695945050505050565b6001600160a01b038281166000818152600660208181526040808420805485845282862054949093528787167fffffffffffffffffffffffff00000000000000000000000000000000000000008416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610a88828483611ac7565b600063ffffffff82111561188f5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f3220626974730000000000000000000000000000000000000000000000000000606482015260840161076c565b5090565b600980546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6119078282611c04565b6002547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff101561199b5760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201527f766572666c6f77696e6720766f74657300000000000000000000000000000000606482015260840161076c565b610a886008611cef83611cfb565b6119b38282611edd565b610a88600861206983611cfb565b60006105696119ce611574565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611a3b87878787612075565b91509150611a4881612180565b5095945050505050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b6001600160a01b038381166000908152600660205260408082205485841683529120546109f392918216911683611ac7565b6000611abb60028484186127a2565b6105669084841661274d565b816001600160a01b0316836001600160a01b031614158015611ae95750600081115b156109f3576001600160a01b03831615611b77576001600160a01b03831660009081526007602052604081208190611b249061206985611cfb565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611b6c929190918252602082015260400190565b60405180910390a250505b6001600160a01b038216156109f3576001600160a01b03821660009081526007602052604081208190611bad90611cef85611cfb565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611bf5929190918252602082015260400190565b60405180910390a25050505050565b6001600160a01b038216611c5a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161076c565b8060026000828254611c6c919061274d565b90915550506001600160a01b03821660009081526020819052604081208054839290611c9990849061274d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611ceb60008383611a7a565b5050565b6000610566828461274d565b825460009081908015611d5b5785611d14600183612760565b81548110611d2457611d24612773565b60009182526020909120015464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611d5e565b60005b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169250611d8c83858763ffffffff16565b9150600081118015611dca57504386611da6600184612760565b81548110611db657611db6612773565b60009182526020909120015463ffffffff16145b15611e5457611dd88261236c565b86611de4600184612760565b81548110611df457611df4612773565b9060005260206000200160000160046101000a8154817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550611ed4565b856040518060400160405280611e6943611813565b63ffffffff168152602001611e7d8561236c565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff90811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b50935093915050565b6001600160a01b038216611f595760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b03821660009081526020819052604090205481811015611fe85760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0383166000908152602081905260408120838303905560028054849290612017908490612760565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36109f383600084611a7a565b60006105668284612760565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156120ac5750600090506003612177565b8460ff16601b141580156120c457508460ff16601c14155b156120d55750600090506004612177565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612129573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b03811661217057600060019250925050612177565b9150600090505b94509492505050565b6000816004811115612194576121946127dd565b0361219c5750565b60018160048111156121b0576121b06127dd565b036121fd5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161076c565b6002816004811115612211576122116127dd565b0361225e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161076c565b6003816004811115612272576122726127dd565b036122e55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b60048160048111156122f9576122f96127dd565b036108605760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561188f5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f3234206269747300000000000000000000000000000000000000000000000000606482015260840161076c565b80356001600160a01b038116811461241757600080fd5b919050565b6000806040838503121561242f57600080fd5b61243883612400565b946020939093013593505050565b600060208083528351808285015260005b8181101561247357858101830151858201604001528201612457565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600080600080608085870312156124c857600080fd5b843593506124d860208601612400565b92506124e660408601612400565b9396929550929360600135925050565b60008060006060848603121561250b57600080fd5b61251484612400565b925061252260208501612400565b9150604084013590509250925092565b60006020828403121561254457600080fd5b61056682612400565b60008060006060848603121561256257600080fd5b8335925061252260208501612400565b60006020828403121561258457600080fd5b5035919050565b803560ff8116811461241757600080fd5b60008060008060008060c087890312156125b557600080fd5b6125be87612400565b955060208701359450604087013593506125da6060880161258b565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a03121561260f57600080fd5b61261888612400565b965061262660208901612400565b955060408801359450606088013593506126426080890161258b565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561267157600080fd5b61267a83612400565b915061268860208401612400565b90509250929050565b600080604083850312156126a457600080fd5b6126ad83612400565b9150602083013563ffffffff811681146126c657600080fd5b809150509250929050565b600181811c908216806126e557607f821691505b602082108103611a74577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156105695761056961271e565b818103818111156105695761056961271e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000826127d8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea26469706673582212205c23091a3d1f80015510377ececa8eecdc6be2b92c3468cca4f84e12ee6f03e864736f6c63430008100033a26469706673582212207672bd575e56b223b77bde4384f7a58f37d6ea2993a11c2e593756913b87706164736f6c634300081000330000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d300000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e6
Deployed Bytecode
0x60806040523480156200001157600080fd5b5060043610620001085760003560e01c80638b79543c11620000a3578063ad007d63116200006e578063ad007d63146200028a578063c41c2f2414620002b2578063ceddd3e414620002da578063ea78803f14620002f157600080fd5b80638b79543c146200021d578063906ebd0f1462000245578063a7f2a70b146200025c578063ac689bcd146200027357600080fd5b8063557e715511620000e4578063557e715514620001885780636607955d14620001d657806375b0d9cd14620001ef578063831d7fac146200020657600080fd5b8062fdd58e146200010d5780631412884f14620001375780635287af37146200015a575b600080fd5b620001246200011e366004620018d2565b6200032a565b6040519081526020015b60405180910390f35b620001246200014836600462001901565b60016020526000908152604090205481565b620001246200016b366004620018d2565b600260209081526000928352604080842090915290825290205481565b620001b07f0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016200012e565b620001ed620001e73660046200191b565b6200041c565b005b620001246200020036600462001901565b6200061a565b620001ed6200021736600462001953565b620006f8565b620001b07f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d381565b620001ed6200025636600462001995565b6200099e565b620001b06200026d36600462001a30565b62000dbe565b620001ed6200028436600462001ab1565b6200103d565b620001b07f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb81565b620001b07f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea81565b620001ed620002eb36600462001995565b620012dc565b620001b06200030236600462001901565b60006020819052908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b73ffffffffffffffffffffffffffffffffffffffff80831660009081526002602090815260408083208584528252808320549183905290912054909116801562000415576040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85811660048301526024820185905282169062fdd58e90604401602060405180830381865afa158015620003e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000406919062001afe565b62000412908362001b47565b91505b5092915050565b8282600b6200042d8383836200162a565b60008581526020819052604090205473ffffffffffffffffffffffffffffffffffffffff16806200048a576040517f73c463ce00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8716600090815260026020908152604080832089845290915290205485811015620004f6576040517f83fc8b2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff88811660008181526002602090815260408083208c845282528083208b8703905560019091529081902080548a90039055517f836a1040000000000000000000000000000000000000000000000000000000008152600481018a90526024810191909152604481018890529083169063836a104090606401600060405180830381600087803b1580156200059e57600080fd5b505af1158015620005b3573d6000803e3d6000fd5b505060408051848152602081018a9052338183015290518a935073ffffffffffffffffffffffffffffffffffffffff8c1692507fe718784128df3c3d45fbd6519133fee450494f7cdb2b53830a5087cd47f980829181900360600190a35050505050505050565b600081815260016020908152604080832054918390529091205473ffffffffffffffffffffffffffffffffffffffff168015620006f2576040517fbd85b0390000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff82169063bd85b03990602401602060405180830381865afa158015620006bd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006e3919062001afe565b620006ef908362001b47565b91505b50919050565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018390527f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d373ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa15801562000784573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620007aa919062001b5d565b826008620007ba8383836200162a565b73ffffffffffffffffffffffffffffffffffffffff841662000808576040517f24679e7b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526020819052604090205473ffffffffffffffffffffffffffffffffffffffff161562000865576040517f97f9d95700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620008b1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620008d7919062001b84565b60ff1660121462000914576040517fadc38c9400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000858152602081815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8816908117909155915133815287917ff2b3bb02e24e3ecd8d6fbce63d308207ce06307b9f7ba575bef710e1e70ac60e910160405180910390a35050505050565b6040517f5dd8f6aa000000000000000000000000000000000000000000000000000000008152600481018490528390339073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea1690635dd8f6aa90602401602060405180830381865afa15801562000a2e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a54919062001b5d565b73ffffffffffffffffffffffffffffffffffffffff161462000aa2576040517fab7f741400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152602081815260408083205473ffffffffffffffffffffffffffffffffffffffff89811685526002845282852089865290935290832054911691821562000b85576040517efdd58e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301526024820189905284169062fdd58e90604401602060405180830381865afa15801562000b59573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000b7f919062001afe565b62000b88565b60005b905062000b96828262001b47565b86111562000bd0576040517fe793143800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000811562000c1057851562000bf95786821062000bef578662000bf1565b815b905062000c10565b86831062000c0957600062000c0d565b8287035b90505b80870387821462000cb05773ffffffffffffffffffffffffffffffffffffffff8a1660009081526002602090815260408083208c845290915290205462000c5990829062001ba9565b73ffffffffffffffffffffffffffffffffffffffff8b1660009081526002602090815260408083208d845282528083209390935560019052205462000ca090829062001ba9565b60008a8152600160205260409020555b811562000d49576040517f9eea5f66000000000000000000000000000000000000000000000000000000008152600481018a905273ffffffffffffffffffffffffffffffffffffffff8b8116602483015260448201849052861690639eea5f6690606401600060405180830381600087803b15801562000d2f57600080fd5b505af115801562000d44573d6000803e3d6000fd5b505050505b60408051898152602081018690529081018490528715156060820152336080820152899073ffffffffffffffffffffffffffffffffffffffff8c16907fbe100da6adaa492f7ba1b0de916ae2606126ec7b044d7aa8ec74971a607ceecd9060a00160405180910390a350505050505050505050565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018690526000907f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d373ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa15801562000e4d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000e73919062001b5d565b86600762000e838383836200162a565b600087900362000ebf576040517f92bf449d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600085900362000efb576040517f571431a700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008981526020819052604090205473ffffffffffffffffffffffffffffffffffffffff161562000f58576040517fa54630ac00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b878787878c60405162000f6b906200189e565b62000f7b95949392919062001c08565b604051809103906000f08015801562000f98573d6000803e3d6000fd5b5060008a8152602081905260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84169081179091559051919550908a907f1b1705bef26552c8f314c5eb80e9c84f02876c2f7f30a7f9ad5cafd17d5fa6da9062001029908c908c908c908c90339062001c46565b60405180910390a350505095945050505050565b8383600c6200104e8383836200162a565b6040517f43a266c2000000000000000000000000000000000000000000000000000000008152600481018790526000907f0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e673ffffffffffffffffffffffffffffffffffffffff16906343a266c29060240161012060405180830381865afa158015620010de573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001104919062001cfe565b9050620011118162001823565b60400151156200114d576040517f18cdaf9700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff86166200119b576040517fc6587bab00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff881660009081526002602090815260408083208a84529091529020548086111562001207576040517f83fc8b2d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808a1660009081526002602081815260408084208d855282528084208b87039055938b1683529081528282208b8352905220546200125c90879062001b47565b73ffffffffffffffffffffffffffffffffffffffff88811660008181526002602090815260408083208e84528252918290209490945580518a8152339481019490945290928b928d16917fae47e55abe3902569528abe4272b889079230a248aec0659a2939a90354982c6910160405180910390a4505050505050505050565b6040517f5dd8f6aa000000000000000000000000000000000000000000000000000000008152600481018490528390339073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea1690635dd8f6aa90602401602060405180830381865afa1580156200136c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001392919062001b5d565b73ffffffffffffffffffffffffffffffffffffffff1614620013e0576040517fab7f741400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008481526020819052604081205473ffffffffffffffffffffffffffffffffffffffff169083801562001429575073ffffffffffffffffffffffffffffffffffffffff821615155b90508015620014c9576040517f836a10400000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff88811660248301526044820187905283169063836a104090606401600060405180830381600087803b158015620014aa57600080fd5b505af1158015620014bf573d6000803e3d6000fd5b505050506200155e565b73ffffffffffffffffffffffffffffffffffffffff871660009081526002602090815260408083208984529091529020546200150790869062001b47565b73ffffffffffffffffffffffffffffffffffffffff881660009081526002602090815260408083208a84528252808320939093556001905220546200154e90869062001b47565b6000878152600160205260409020555b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff62001586876200061a565b1115620015bf576040517f60c5e71200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080518681528215156020820152851515818301523360608201529051879173ffffffffffffffffffffffffffffffffffffffff8a16917f5dd3ead325af435e56bc762b40de54c96de6071938d18a26414245807591d86f9181900360800190a350505050505050565b3373ffffffffffffffffffffffffffffffffffffffff8416148015906200171557506040517fc161c93f00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff848116602483015260448201849052606482018390527f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb169063c161c93f90608401602060405180830381865afa158015620016ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001713919062001d83565b155b8015620017e657506040517fc161c93f00000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff848116602483015260006044830152606482018390527f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb169063c161c93f90608401602060405180830381865afa158015620017be573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620017e4919062001d83565b155b156200181e576040517f075fd2b100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b6040805160608101825260008082526020820181905291810191909152620018986008836101000151901c604080516060808201835260008083526020808401829052928401528251908101835260018481168114825284811c811681149282019290925260029390931c8116149082015290565b92915050565b612d148062001da483390190565b73ffffffffffffffffffffffffffffffffffffffff81168114620018cf57600080fd5b50565b60008060408385031215620018e657600080fd5b8235620018f381620018ac565b946020939093013593505050565b6000602082840312156200191457600080fd5b5035919050565b6000806000606084860312156200193157600080fd5b83356200193e81620018ac565b95602085013595506040909401359392505050565b600080604083850312156200196757600080fd5b8235915060208301356200197b81620018ac565b809150509250929050565b8015158114620018cf57600080fd5b60008060008060808587031215620019ac57600080fd5b8435620019b981620018ac565b935060208501359250604085013591506060850135620019d98162001986565b939692955090935050565b60008083601f840112620019f757600080fd5b50813567ffffffffffffffff81111562001a1057600080fd5b60208301915083602082850101111562001a2957600080fd5b9250929050565b60008060008060006060868803121562001a4957600080fd5b85359450602086013567ffffffffffffffff8082111562001a6957600080fd5b62001a7789838a01620019e4565b9096509450604088013591508082111562001a9157600080fd5b5062001aa088828901620019e4565b969995985093965092949392505050565b6000806000806080858703121562001ac857600080fd5b843562001ad581620018ac565b935060208501359250604085013562001aee81620018ac565b9396929550929360600135925050565b60006020828403121562001b1157600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111562001898576200189862001b18565b60006020828403121562001b7057600080fd5b815162001b7d81620018ac565b9392505050565b60006020828403121562001b9757600080fd5b815160ff8116811462001b7d57600080fd5b8181038181111562001898576200189862001b18565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b60608152600062001c1e60608301878962001bbf565b828103602084015262001c3381868862001bbf565b9150508260408301529695505050505050565b60608152600062001c5c60608301878962001bbf565b828103602084015262001c7181868862001bbf565b91505073ffffffffffffffffffffffffffffffffffffffff831660408301529695505050505050565b604051610120810167ffffffffffffffff8111828210171562001ce6577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405290565b805162001cf981620018ac565b919050565b6000610120828403121562001d1257600080fd5b62001d1c62001c9a565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015262001d6a60e0840162001cec565b60e0820152610100928301519281019290925250919050565b60006020828403121562001d9657600080fd5b815162001b7d816200198656fe6101806040527f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9610140523480156200003757600080fd5b5060405162002d1438038062002d148339810160408190526200005a9162000258565b6040805180820190915260018152603160f81b602082015283908190818560036200008683826200035a565b5060046200009582826200035a565b5050825160209384012082519284019290922060e08390526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f818901819052818301979097526060810194909452608080850193909352308483018190528151808603909301835260c09485019091528151919096012090529290925261012052506200013490503362000141565b6101605250620004269050565b600980546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001bb57600080fd5b81516001600160401b0380821115620001d857620001d862000193565b604051601f8301601f19908116603f0116810190828211818310171562000203576200020362000193565b816040528381526020925086838588010111156200022057600080fd5b600091505b8382101562000244578582018301518183018401529082019062000225565b600093810190920192909252949350505050565b6000806000606084860312156200026e57600080fd5b83516001600160401b03808211156200028657600080fd5b6200029487838801620001a9565b94506020860151915080821115620002ab57600080fd5b50620002ba86828701620001a9565b925050604084015190509250925092565b600181811c90821680620002e057607f821691505b6020821081036200030157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200035557600081815260208120601f850160051c81016020861015620003305750805b601f850160051c820191505b8181101562000351578281556001016200033c565b5050505b505050565b81516001600160401b0381111562000376576200037662000193565b6200038e81620003878454620002cb565b8462000307565b602080601f831160018114620003c65760008415620003ad5750858301515b600019600386901b1c1916600185901b17855562000351565b600085815260208120601f198616915b82811015620003f757888601518255948401946001909101908401620003d6565b5085821015620004165787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e05161010051610120516101405161016051612842620004d2600039600081816102df0152818161061901528181610643015281816109650152818161098f015281816109fa01528181610a2401528181610c0601528181610c3001528181611171015261119b01526000610ee7015260006115fe0152600061164d0152600061162801526000611581015260006115ab015260006115d501526128426000f3fe608060405234801561001057600080fd5b506004361061020a5760003560e01c80637ecebe001161012a578063a457c2d7116100bd578063d505accf1161008c578063f1127ed811610071578063f1127ed8146104d4578063f2fde38b14610526578063f8548e361461053957600080fd5b8063d505accf14610488578063dd62ed3e1461049b57600080fd5b8063a457c2d71461043c578063a9059cbb1461044f578063bd85b03914610462578063c3cda5201461047557600080fd5b80638e539e8c116100f95780638e539e8c146103fb57806395d89b411461040e5780639ab24eb0146104165780639eea5f661461042957600080fd5b80637ecebe00146103b1578063836a1040146103c45780638cb0a511146103d75780638da5cb5b146103ea57600080fd5b806339509351116101a25780635c19a95c116101715780635c19a95c146103455780636fcfff451461035857806370a0823114610380578063715018a6146103a957600080fd5b806339509351146102b45780633a46b1a8146102c75780633fafa127146102da578063587cde1e1461030157600080fd5b80631c0f12b6116101de5780631c0f12b61461027557806323b872dd1461028a578063313ce5671461029d5780633644e515146102ac57600080fd5b8062fdd58e1461020f57806306fdde0314610235578063095ea7b31461024a57806318160ddd1461026d575b600080fd5b61022261021d36600461241c565b61054c565b6040519081526020015b60405180910390f35b61023d61056f565b60405161022c9190612446565b61025d61025836600461241c565b610601565b604051901515815260200161022c565b600254610222565b6102886102833660046124b2565b610617565b005b61025d6102983660046124f6565b6106af565b6040516012815260200161022c565b61022261079d565b61025d6102c236600461241c565b6107a7565b6102226102d536600461241c565b6107e3565b6102227f000000000000000000000000000000000000000000000000000000000000000081565b61032d61030f366004612532565b6001600160a01b039081166000908152600660205260409020541690565b6040516001600160a01b03909116815260200161022c565b610288610353366004612532565b610856565b61036b610366366004612532565b610863565b60405163ffffffff909116815260200161022c565b61022261038e366004612532565b6001600160a01b031660009081526020819052604090205490565b610288610885565b6102226103bf366004612532565b6108eb565b6102886103d236600461254d565b610909565b6102886103e536600461254d565b6109f8565b6009546001600160a01b031661032d565b610222610409366004612572565b610a8e565b61023d610aea565b610222610424366004612532565b610af9565b61028861043736600461254d565b610baa565b61025d61044a36600461241c565b610c94565b61025d61045d36600461241c565b610d45565b610222610470366004612572565b610d52565b61028861048336600461259c565b610d5d565b6102886104963660046125f4565b610e93565b6102226104a936600461265e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6104e76104e2366004612691565b610ff7565b60408051825163ffffffff1681526020928301517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16928101929092520161022c565b610288610534366004612532565b611090565b61028861054736600461254d565b61116f565b6001600160a01b0382166000908152602081905260408120545b90505b92915050565b60606003805461057e906126d1565b80601f01602080910402602001604051908101604052809291908181526020018280546105aa906126d1565b80156105f75780601f106105cc576101008083540402835291602001916105f7565b820191906000526020600020905b8154815290600101906020018083116105da57829003601f168201915b5050505050905090565b600061060e3384846111ff565b50600192915050565b7f00000000000000000000000000000000000000000000000000000000000000001580159061066657507f00000000000000000000000000000000000000000000000000000000000000008414155b1561069d576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6106a88383836106af565b5050505050565b6001600160a01b03831660009081526001602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff811461078257828110156107755760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160448201527f6c6c6f77616e636500000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b61078285338584036111ff565b61078d858585611357565b506001949350505050565b905090565b6000610798611574565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161060e9185906107de90869061274d565b6111ff565b60004382106108345760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161076c565b6001600160a01b0383166000908152600760205260409020610566908361169b565b6108603382611782565b50565b6001600160a01b03811660009081526007602052604081205461056990611813565b6009546001600160a01b031633146108df5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b6108e96000611893565b565b6001600160a01b038116600090815260056020526040812054610569565b6009546001600160a01b031633146109635760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b7f0000000000000000000000000000000000000000000000000000000000000000158015906109b257507f00000000000000000000000000000000000000000000000000000000000000008314155b156109e9576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f382826118fd565b505050565b7f000000000000000000000000000000000000000000000000000000000000000015801590610a4757507f00000000000000000000000000000000000000000000000000000000000000008314155b15610a7e576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a888282610601565b50505050565b6000438210610adf5760405162461bcd60e51b815260206004820152601f60248201527f4552433230566f7465733a20626c6f636b206e6f7420796574206d696e656400604482015260640161076c565b61056960088361169b565b60606004805461057e906126d1565b6001600160a01b0381166000908152600760205260408120548015610b82576001600160a01b0383166000908152600760205260409020610b3b600183612760565b81548110610b4b57610b4b612773565b60009182526020909120015464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16610b85565b60005b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169392505050565b6009546001600160a01b03163314610c045760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b7f000000000000000000000000000000000000000000000000000000000000000015801590610c5357507f00000000000000000000000000000000000000000000000000000000000000008314155b15610c8a576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6109f382826119a9565b3360009081526001602090815260408083206001600160a01b038616845290915281205482811015610d2e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f000000000000000000000000000000000000000000000000000000606482015260840161076c565b610d3b33858584036111ff565b5060019392505050565b600061060e338484611357565b600061056960025490565b83421115610dad5760405162461bcd60e51b815260206004820152601d60248201527f4552433230566f7465733a207369676e61747572652065787069726564000000604482015260640161076c565b604080517fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60208201526001600160a01b038816918101919091526060810186905260808101859052600090610e2790610e1f9060a001604051602081830303815290604052805190602001206119c1565b858585611a2a565b9050610e3281611a52565b8614610e805760405162461bcd60e51b815260206004820152601960248201527f4552433230566f7465733a20696e76616c6964206e6f6e636500000000000000604482015260640161076c565b610e8a8188611782565b50505050505050565b83421115610ee35760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e65000000604482015260640161076c565b60007f0000000000000000000000000000000000000000000000000000000000000000888888610f128c611a52565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610f6d826119c1565b90506000610f7d82878787611a2a565b9050896001600160a01b0316816001600160a01b031614610fe05760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e61747572650000604482015260640161076c565b610feb8a8a8a6111ff565b50505050505050505050565b60408051808201909152600080825260208201526001600160a01b0383166000908152600760205260409020805463ffffffff841690811061103b5761103b612773565b60009182526020918290206040805180820190915291015463ffffffff8116825264010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16918101919091529392505050565b6009546001600160a01b031633146110ea5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161076c565b6001600160a01b0381166111665760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161076c565b61086081611893565b7f0000000000000000000000000000000000000000000000000000000000000000158015906111be57507f00000000000000000000000000000000000000000000000000000000000000008314155b156111f5576040517fcdceed0000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610a888282610d45565b6001600160a01b03831661127a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f7265737300000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0382166112f65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f7373000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166113d35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f6472657373000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b03821661144f5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f6573730000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b038316600090815260208190526040902054818110156114de5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e63650000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061151590849061274d565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161156191815260200190565b60405180910390a3610a88848484611a7a565b6000306001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161480156115cd57507f000000000000000000000000000000000000000000000000000000000000000046145b156115f757507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b8154600090815b818110156116ff5760006116b68284611aac565b9050848682815481106116cb576116cb612773565b60009182526020909120015463ffffffff1611156116eb578092506116f9565b6116f681600161274d565b91505b506116a2565b81156117585784611711600184612760565b8154811061172157611721612773565b60009182526020909120015464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1661175b565b60005b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1695945050505050565b6001600160a01b038281166000818152600660208181526040808420805485845282862054949093528787167fffffffffffffffffffffffff00000000000000000000000000000000000000008416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610a88828483611ac7565b600063ffffffff82111561188f5760405162461bcd60e51b815260206004820152602660248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203360448201527f3220626974730000000000000000000000000000000000000000000000000000606482015260840161076c565b5090565b600980546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6119078282611c04565b6002547bffffffffffffffffffffffffffffffffffffffffffffffffffffffff101561199b5760405162461bcd60e51b815260206004820152603060248201527f4552433230566f7465733a20746f74616c20737570706c79207269736b73206f60448201527f766572666c6f77696e6720766f74657300000000000000000000000000000000606482015260840161076c565b610a886008611cef83611cfb565b6119b38282611edd565b610a88600861206983611cfb565b60006105696119ce611574565b836040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b6000806000611a3b87878787612075565b91509150611a4881612180565b5095945050505050565b6001600160a01b03811660009081526005602052604090208054600181018255905b50919050565b6001600160a01b038381166000908152600660205260408082205485841683529120546109f392918216911683611ac7565b6000611abb60028484186127a2565b6105669084841661274d565b816001600160a01b0316836001600160a01b031614158015611ae95750600081115b156109f3576001600160a01b03831615611b77576001600160a01b03831660009081526007602052604081208190611b249061206985611cfb565b91509150846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611b6c929190918252602082015260400190565b60405180910390a250505b6001600160a01b038216156109f3576001600160a01b03821660009081526007602052604081208190611bad90611cef85611cfb565b91509150836001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248383604051611bf5929190918252602082015260400190565b60405180910390a25050505050565b6001600160a01b038216611c5a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161076c565b8060026000828254611c6c919061274d565b90915550506001600160a01b03821660009081526020819052604081208054839290611c9990849061274d565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a3611ceb60008383611a7a565b5050565b6000610566828461274d565b825460009081908015611d5b5785611d14600183612760565b81548110611d2457611d24612773565b60009182526020909120015464010000000090047bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611d5e565b60005b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff169250611d8c83858763ffffffff16565b9150600081118015611dca57504386611da6600184612760565b81548110611db657611db6612773565b60009182526020909120015463ffffffff16145b15611e5457611dd88261236c565b86611de4600184612760565b81548110611df457611df4612773565b9060005260206000200160000160046101000a8154817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff02191690837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff160217905550611ed4565b856040518060400160405280611e6943611813565b63ffffffff168152602001611e7d8561236c565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff90811690915282546001810184556000938452602093849020835194909301519091166401000000000263ffffffff909316929092179101555b50935093915050565b6001600160a01b038216611f595760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f7300000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b03821660009081526020819052604090205481811015611fe85760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f6365000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b6001600160a01b0383166000908152602081905260408120838303905560028054849290612017908490612760565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a36109f383600084611a7a565b60006105668284612760565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156120ac5750600090506003612177565b8460ff16601b141580156120c457508460ff16601c14155b156120d55750600090506004612177565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015612129573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001519150506001600160a01b03811661217057600060019250925050612177565b9150600090505b94509492505050565b6000816004811115612194576121946127dd565b0361219c5750565b60018160048111156121b0576121b06127dd565b036121fd5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161076c565b6002816004811115612211576122116127dd565b0361225e5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161076c565b6003816004811115612272576122726127dd565b036122e55760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b60048160048111156122f9576122f96127dd565b036108605760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c60448201527f7565000000000000000000000000000000000000000000000000000000000000606482015260840161076c565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff82111561188f5760405162461bcd60e51b815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203260448201527f3234206269747300000000000000000000000000000000000000000000000000606482015260840161076c565b80356001600160a01b038116811461241757600080fd5b919050565b6000806040838503121561242f57600080fd5b61243883612400565b946020939093013593505050565b600060208083528351808285015260005b8181101561247357858101830151858201604001528201612457565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b600080600080608085870312156124c857600080fd5b843593506124d860208601612400565b92506124e660408601612400565b9396929550929360600135925050565b60008060006060848603121561250b57600080fd5b61251484612400565b925061252260208501612400565b9150604084013590509250925092565b60006020828403121561254457600080fd5b61056682612400565b60008060006060848603121561256257600080fd5b8335925061252260208501612400565b60006020828403121561258457600080fd5b5035919050565b803560ff8116811461241757600080fd5b60008060008060008060c087890312156125b557600080fd5b6125be87612400565b955060208701359450604087013593506125da6060880161258b565b92506080870135915060a087013590509295509295509295565b600080600080600080600060e0888a03121561260f57600080fd5b61261888612400565b965061262660208901612400565b955060408801359450606088013593506126426080890161258b565b925060a0880135915060c0880135905092959891949750929550565b6000806040838503121561267157600080fd5b61267a83612400565b915061268860208401612400565b90509250929050565b600080604083850312156126a457600080fd5b6126ad83612400565b9150602083013563ffffffff811681146126c657600080fd5b809150509250929050565b600181811c908216806126e557607f821691505b602082108103611a74577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156105695761056961271e565b818103818111156105695761056961271e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000826127d8577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fdfea26469706673582212205c23091a3d1f80015510377ececa8eecdc6be2b92c3468cca4f84e12ee6f03e864736f6c63430008100033a26469706673582212207672bd575e56b223b77bde4384f7a58f37d6ea2993a11c2e593756913b87706164736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d300000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e6
-----Decoded View---------------
Arg [0] : _operatorStore (address): 0x6F3C5afCa0c9eDf3926eF2dDF17c8ae6391afEfb
Arg [1] : _projects (address): 0xD8B4359143eda5B2d763E127Ed27c77addBc47d3
Arg [2] : _directory (address): 0x65572FB928b46f9aDB7cfe5A4c41226F636161ea
Arg [3] : _fundingCycleStore (address): 0x6f18cF9173136c0B5A6eBF45f19D58d3ff2E17e6
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb
Arg [1] : 000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d3
Arg [2] : 00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea
Arg [3] : 0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.