Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 92 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Batch Fill | 14738983 | 987 days ago | IN | 0 ETH | 0.00894353 | ||||
Batch Fill | 14738591 | 987 days ago | IN | 0 ETH | 0.01288929 | ||||
Batch Fill | 14738007 | 987 days ago | IN | 0 ETH | 0.00785147 | ||||
Batch Fill | 14737754 | 987 days ago | IN | 0 ETH | 0.01206799 | ||||
Batch Fill | 14712322 | 991 days ago | IN | 0 ETH | 0.01223267 | ||||
Batch Fill | 14711332 | 991 days ago | IN | 0 ETH | 0.02109052 | ||||
Batch Fill | 14657910 | 1000 days ago | IN | 0 ETH | 0.00820617 | ||||
Batch Fill | 14642137 | 1002 days ago | IN | 0 ETH | 0.01534173 | ||||
Batch Fill | 14606138 | 1008 days ago | IN | 0 ETH | 0.01524657 | ||||
Batch Fill | 14603573 | 1008 days ago | IN | 0 ETH | 0.02120553 | ||||
Batch Fill | 14592870 | 1010 days ago | IN | 0 ETH | 0.00478813 | ||||
Batch Fill | 14592838 | 1010 days ago | IN | 0 ETH | 0.00433226 | ||||
Batch Fill | 14530605 | 1020 days ago | IN | 0 ETH | 0.01623619 | ||||
Batch Fill | 14523679 | 1021 days ago | IN | 0 ETH | 0.02109141 | ||||
Batch Fill | 14517819 | 1021 days ago | IN | 0 ETH | 0.05206762 | ||||
Batch Fill | 14517802 | 1021 days ago | IN | 0 ETH | 0.01281675 | ||||
Batch Fill | 14515841 | 1022 days ago | IN | 0 ETH | 0.02121768 | ||||
Batch Fill | 14512301 | 1022 days ago | IN | 0 ETH | 0.01828621 | ||||
Batch Fill | 14512255 | 1022 days ago | IN | 0 ETH | 0.05230648 | ||||
Batch Fill | 14510721 | 1023 days ago | IN | 0 ETH | 0.00908005 | ||||
Batch Fill | 14510535 | 1023 days ago | IN | 0 ETH | 0.0235818 | ||||
Batch Fill | 14505238 | 1023 days ago | IN | 0 ETH | 0.00941841 | ||||
Batch Fill | 14504850 | 1024 days ago | IN | 0 ETH | 0.02364205 | ||||
Batch Fill | 14504684 | 1024 days ago | IN | 0 ETH | 0.02790707 | ||||
Batch Fill | 14437326 | 1034 days ago | IN | 0 ETH | 0.0070334 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
BountyBoard
Compiler Version
v0.8.11+commit.d7f03943
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "../interfaces/IERC721Validator.sol"; import "../interfaces/IBountyBoard.sol"; /// @title BountyBoard /// @author sina.eth /// @notice Broker for offers to mint ERC20 tokens in exchange for ERC721s contract BountyBoard is Ownable, IBountyBoard, IERC721Receiver { event OrderCreated( Order order, uint256 maxFills, address indexed tokenAddress, address indexed nftBeneficiary, bytes32 indexed orderHash ); event OrdersFilled(OrderGrouping[] orderGroupings); event OrderFilled( bytes32 orderHash, address erc721Address, uint256 erc721Id ); event OrderDisabled(bytes32 indexed orderHash); error BadOrderParamsError(); error OrderCreatorMissingMinterRoleError(); error BountyBoardMissingMinterRoleError(); error OrderAlreadyExistsError(); error InvalidOrderError(); error InvalidNftError(address addr, uint256 id); error OrderAlreadyDisabledError(); error MissingOrderDisablerRoleError(); struct Order { IERC721Validator validator; ERC20PresetMinterPauser erc20; address nftBeneficiary; uint256 tokensPerTribute; uint256 expirationTime; } struct OrderGrouping { Order order; ERC721Grouping[] erc721Groupings; } bytes32 public immutable ORDER_DISABLER_ROLE; /// Orders are kept as a map from hash of order /// params to remaining number of fills. mapping(bytes32 => uint256) public remainingFills; constructor(address owner) { ORDER_DISABLER_ROLE = keccak256( abi.encode(address(this), "DISABLE_ORDER_ROLE") ); transferOwnership(owner); } function hashOrder(Order memory order) public pure returns (bytes32) { return keccak256(abi.encode(order)); } /// @notice Adds an order to the "BountyBoard" orderbook /// @param order Struct of all the order params that stay static. /// @param maxFills Maximum number of NFTs this order can be filled for /// @return orderHash The unique identifying hash for the added order function addOrder(Order calldata order, uint256 maxFills) external returns (bytes32 orderHash) { // Checks if (order.expirationTime <= block.timestamp || maxFills == 0) { revert BadOrderParamsError(); } if (!order.erc20.hasRole(order.erc20.MINTER_ROLE(), msg.sender)) { revert OrderCreatorMissingMinterRoleError(); } if (!order.erc20.hasRole(order.erc20.MINTER_ROLE(), address(this))) { revert BountyBoardMissingMinterRoleError(); } orderHash = hashOrder(order); if (remainingFills[orderHash] != 0) { revert OrderAlreadyExistsError(); } // Add new order remainingFills[orderHash] = maxFills; emit OrderCreated( order, maxFills, address(order.erc20), order.nftBeneficiary, orderHash ); } /// @notice Disables an order /// @param order Payload of order to be disabled function disableOrder(Order calldata order) external { if (!order.erc20.hasRole(ORDER_DISABLER_ROLE, msg.sender)) { revert MissingOrderDisablerRoleError(); } bytes32 orderHash = hashOrder(order); remainingFills[orderHash] = 0; emit OrderDisabled(orderHash); } /// @notice Handles filling an order via a ERC721Received callback function onERC721Received( address, // operator address from, uint256 tokenId, bytes calldata data ) external override returns (bytes4) { Order memory order = abi.decode(data, (Order)); bytes32 orderHash = hashOrder(order); if ( !IERC721Validator(order.validator).meetsCriteria( msg.sender, // the NFT contract address tokenId ) ) { revert InvalidNftError(msg.sender, tokenId); } if ( order.expirationTime <= block.timestamp || remainingFills[orderHash] == 0 ) { revert InvalidOrderError(); } unchecked { // Checked above that this is not zero remainingFills[orderHash] -= 1; } // Payout to order filler and beneficiary order.erc20.mint(from, order.tokensPerTribute); IERC721(msg.sender).safeTransferFrom( address(this), order.nftBeneficiary, tokenId ); emit OrderFilled(orderHash, msg.sender, tokenId); return this.onERC721Received.selector; } /// @notice Fills a single order multiple times /// @param orderGroupings Struct entailing the orders to be filled associated with their ERC721s function batchFill(OrderGrouping[] calldata orderGroupings) external { for (uint256 i = 0; i < orderGroupings.length; i++) { batchFillOrder( orderGroupings[i].order, orderGroupings[i].erc721Groupings ); } emit OrdersFilled(orderGroupings); } function batchFillOrder( Order calldata order, ERC721Grouping[] calldata erc721Groupings ) internal { if (order.expirationTime <= block.timestamp) { revert InvalidOrderError(); } bytes32 orderHash = hashOrder(order); uint256 tributeCounter = 0; IERC721 erc721; uint256 id; for (uint256 i = 0; i < erc721Groupings.length; i++) { tributeCounter += erc721Groupings[i].ids.length; erc721 = erc721Groupings[i].erc721; for (uint256 j = 0; j < erc721Groupings[i].ids.length; j++) { id = erc721Groupings[i].ids[j]; if (!order.validator.meetsCriteria(address(erc721), id)) { revert InvalidNftError(address(erc721), id); } // Forward NFT to benecifiary // NOTE: reentrancy should be safe here, since we're decrementing // the number of fills based on its later value. erc721.safeTransferFrom( erc721.ownerOf(id), order.nftBeneficiary, id ); } } // Should throw if underflow remainingFills[orderHash] -= tributeCounter; // Payout to order filler order.erc20.mint(msg.sender, order.tokensPerTribute * tributeCounter); } function recoverERC20(IERC20 tokenAddress, uint256 amount) external onlyOwner { tokenAddress.transfer(owner(), amount); } function recoverERC721(IERC721 tokenAddress, uint256 tokenId) external onlyOwner { tokenAddress.safeTransferFrom(address(this), owner(), tokenId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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 v4.4.0 (token/ERC20/presets/ERC20PresetMinterPauser.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../extensions/ERC20Burnable.sol"; import "../extensions/ERC20Pausable.sol"; import "../../../access/AccessControlEnumerable.sol"; import "../../../utils/Context.sol"; /** * @dev {ERC20} token, including: * * - ability for holders to burn (destroy) their tokens * - a minter role that allows for token minting (creation) * - a pauser role that allows to stop all token transfers * * This contract uses {AccessControl} to lock permissioned functions using the * different roles - head to its documentation for details. * * The account that deploys the contract will be granted the minter and pauser * roles, as well as the default admin role, which will let it grant both minter * and pauser roles to other accounts. */ contract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. * * See {ERC20-constructor}. */ constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } /** * @dev Creates `amount` new tokens for `to`. * * See {ERC20-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, uint256 amount) public virtual { require(hasRole(MINTER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have minter role to mint"); _mint(to, amount); } /** * @dev Pauses all token transfers. * * See {ERC20Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC20Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC20PresetMinterPauser: must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override(ERC20, ERC20Pausable) { super._beforeTokenTransfer(from, to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.0 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC721Validator { function meetsCriteria(address tokenAddress, uint256 tokenId) external view returns (bool); }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; interface IBountyBoard { struct ERC721Grouping { IERC721 erc721; uint256[] ids; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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.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}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { _approve(_msgSender(), spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) public virtual override returns (bool) { _transfer(sender, recipient, amount); uint256 currentAllowance = _allowances[sender][_msgSender()]; require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance"); unchecked { _approve(sender, _msgSender(), currentAllowance - amount); } return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { _approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { uint256 currentAllowance = _allowances[_msgSender()][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(_msgSender(), spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal virtual { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(sender, recipient, amount); uint256 senderBalance = _balances[sender]; require(senderBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[sender] = senderBalance - amount; } _balances[recipient] += amount; emit Transfer(sender, recipient, amount); _afterTokenTransfer(sender, recipient, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { uint256 currentAllowance = allowance(account, _msgSender()); require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance"); unchecked { _approve(account, _msgSender(), currentAllowance - amount); } _burn(account, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/extensions/ERC20Pausable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `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 v4.4.0 (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.0 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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 v4.4.0 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (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); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BadOrderParamsError","type":"error"},{"inputs":[],"name":"BountyBoardMissingMinterRoleError","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"InvalidNftError","type":"error"},{"inputs":[],"name":"InvalidOrderError","type":"error"},{"inputs":[],"name":"MissingOrderDisablerRoleError","type":"error"},{"inputs":[],"name":"OrderAlreadyDisabledError","type":"error"},{"inputs":[],"name":"OrderAlreadyExistsError","type":"error"},{"inputs":[],"name":"OrderCreatorMissingMinterRoleError","type":"error"},{"anonymous":false,"inputs":[{"components":[{"internalType":"contract IERC721Validator","name":"validator","type":"address"},{"internalType":"contract ERC20PresetMinterPauser","name":"erc20","type":"address"},{"internalType":"address","name":"nftBeneficiary","type":"address"},{"internalType":"uint256","name":"tokensPerTribute","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"indexed":false,"internalType":"struct BountyBoard.Order","name":"order","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"maxFills","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"address","name":"nftBeneficiary","type":"address"},{"indexed":true,"internalType":"bytes32","name":"orderHash","type":"bytes32"}],"name":"OrderCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"orderHash","type":"bytes32"}],"name":"OrderDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"orderHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"erc721Address","type":"address"},{"indexed":false,"internalType":"uint256","name":"erc721Id","type":"uint256"}],"name":"OrderFilled","type":"event"},{"anonymous":false,"inputs":[{"components":[{"components":[{"internalType":"contract IERC721Validator","name":"validator","type":"address"},{"internalType":"contract ERC20PresetMinterPauser","name":"erc20","type":"address"},{"internalType":"address","name":"nftBeneficiary","type":"address"},{"internalType":"uint256","name":"tokensPerTribute","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"internalType":"struct BountyBoard.Order","name":"order","type":"tuple"},{"components":[{"internalType":"contract IERC721","name":"erc721","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct IBountyBoard.ERC721Grouping[]","name":"erc721Groupings","type":"tuple[]"}],"indexed":false,"internalType":"struct BountyBoard.OrderGrouping[]","name":"orderGroupings","type":"tuple[]"}],"name":"OrdersFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"ORDER_DISABLER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC721Validator","name":"validator","type":"address"},{"internalType":"contract ERC20PresetMinterPauser","name":"erc20","type":"address"},{"internalType":"address","name":"nftBeneficiary","type":"address"},{"internalType":"uint256","name":"tokensPerTribute","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"internalType":"struct BountyBoard.Order","name":"order","type":"tuple"},{"internalType":"uint256","name":"maxFills","type":"uint256"}],"name":"addOrder","outputs":[{"internalType":"bytes32","name":"orderHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"contract IERC721Validator","name":"validator","type":"address"},{"internalType":"contract ERC20PresetMinterPauser","name":"erc20","type":"address"},{"internalType":"address","name":"nftBeneficiary","type":"address"},{"internalType":"uint256","name":"tokensPerTribute","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"internalType":"struct BountyBoard.Order","name":"order","type":"tuple"},{"components":[{"internalType":"contract IERC721","name":"erc721","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"internalType":"struct IBountyBoard.ERC721Grouping[]","name":"erc721Groupings","type":"tuple[]"}],"internalType":"struct BountyBoard.OrderGrouping[]","name":"orderGroupings","type":"tuple[]"}],"name":"batchFill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC721Validator","name":"validator","type":"address"},{"internalType":"contract ERC20PresetMinterPauser","name":"erc20","type":"address"},{"internalType":"address","name":"nftBeneficiary","type":"address"},{"internalType":"uint256","name":"tokensPerTribute","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"internalType":"struct BountyBoard.Order","name":"order","type":"tuple"}],"name":"disableOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC721Validator","name":"validator","type":"address"},{"internalType":"contract ERC20PresetMinterPauser","name":"erc20","type":"address"},{"internalType":"address","name":"nftBeneficiary","type":"address"},{"internalType":"uint256","name":"tokensPerTribute","type":"uint256"},{"internalType":"uint256","name":"expirationTime","type":"uint256"}],"internalType":"struct BountyBoard.Order","name":"order","type":"tuple"}],"name":"hashOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"recoverERC721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"remainingFills","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b5060405162001861380380620018618339810160408190526200003491620001c7565b6200003f33620000a2565b6040805130602082015280820191909152601260608201527144495341424c455f4f524445525f524f4c4560701b608082015260a00160408051601f1981840301815291905280516020909101206080526200009b81620000f2565b50620001f9565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000546001600160a01b03163314620001525760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620001b95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000149565b620001c481620000a2565b50565b600060208284031215620001da57600080fd5b81516001600160a01b0381168114620001f257600080fd5b9392505050565b6080516116456200021c600039600081816101b4015261020801526116456000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063715018a611610071578063715018a614610166578063819d4cc61461016e5780638980f11f146101815780638da5cb5b146101945780639ce874ca146101af578063f2fde38b146101d657600080fd5b806302f27e0e146100b95780630bf71eaa146100ce578063137e71bc146100e1578063150b7a02146101075780632498f6be1461013357806352484ce714610146575b600080fd5b6100cc6100c7366004610fef565b6101e9565b005b6100cc6100dc366004611012565b6102fa565b6100f46100ef3660046110ac565b6103b3565b6040519081526020015b60405180910390f35b61011a610115366004611141565b610423565b6040516001600160e01b031990911681526020016100fe565b6100f46101413660046111e0565b61065e565b6100f461015436600461120b565b60016020526000908152604090205481565b6100cc61097e565b6100cc61017c366004611224565b6109b4565b6100cc61018f366004611224565b610a6b565b6000546040516001600160a01b0390911681526020016100fe565b6100f47f000000000000000000000000000000000000000000000000000000000000000081565b6100cc6101e4366004611250565b610b2c565b6101f96040820160208301611250565b604051632474521560e21b81527f000000000000000000000000000000000000000000000000000000000000000060048201523360248201526001600160a01b0391909116906391d1485490604401602060405180830381865afa158015610265573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610289919061126d565b6102a657604051637dae284b60e11b815260040160405180910390fd5b60006102ba6100ef368490038401846110ac565b6000818152600160205260408082208290555191925082917f309afd4ca07b05731ae3bb9970df23cf3f33f474cbcbc6e2252269393ac7b1389190a25050565b60005b818110156103755761036383838381811061031a5761031a61128f565b905060200281019061032c91906112a5565b84848481811061033e5761033e61128f565b905060200281019061035091906112a5565b61035e9060a08101906112c5565b610bc7565b8061036d8161132c565b9150506102fd565b507fbfb56d0cbcb870da34ed8cc0bddc87c7d0312cab02a96d5a48bad91fe76f1e8782826040516103a79291906113e9565b60405180910390a15050565b600081604051602001610406919081516001600160a01b03908116825260208084015182169083015260408084015190911690820152606080830151908201526080918201519181019190915260a00190565b604051602081830303815290604052805190602001209050919050565b600080610432838501856110ac565b9050600061043f826103b3565b8251604051623184cb60e71b8152336004820152602481018990529192506001600160a01b0316906318c2658090604401602060405180830381865afa15801561048d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b1919061126d565b6104dc57604051636812d8d960e01b8152336004820152602481018790526044015b60405180910390fd5b4282608001511115806104fb5750600081815260016020526040902054155b15610519576040516357e43f8f60e01b815260040160405180910390fd5b6000818152600160209081526040918290208054600019019055830151606084015191516340c10f1960e01b81526001600160a01b038a8116600483015260248201939093529116906340c10f1990604401600060405180830381600087803b15801561058557600080fd5b505af1158015610599573d6000803e3d6000fd5b505050506040828101519051632142170760e11b81523060048201526001600160a01b0390911660248201526044810187905233906342842e0e90606401600060405180830381600087803b1580156105f157600080fd5b505af1158015610605573d6000803e3d6000fd5b5050604080518481523360208201529081018990527f091df57229697c69000d4036c8c123d47d4b61cbb946bdbeaa454f31a560a0449250606001905060405180910390a150630a85bd0160e11b979650505050505050565b6000428360800135111580610671575081155b1561068f576040516331d2cf1960e21b815260040160405180910390fd5b61069f6040840160208501611250565b6001600160a01b03166391d148546106bd6040860160208701611250565b6001600160a01b031663d53913936040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071e9190611525565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610760573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610784919061126d565b6107a15760405163079a505160e21b815260040160405180910390fd5b6107b16040840160208501611250565b6001600160a01b03166391d148546107cf6040860160208701611250565b6001600160a01b031663d53913936040518163ffffffff1660e01b8152600401602060405180830381865afa15801561080c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108309190611525565b6040516001600160e01b031960e084901b1681526004810191909152306024820152604401602060405180830381865afa158015610872573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610896919061126d565b6108b357604051630a2e65bd60e11b815260040160405180910390fd5b6108c56100ef368590038501856110ac565b600081815260016020526040902054909150156108f8576040516001624668f760e01b0319815260040160405180910390fd5b60008181526001602052604090819020839055819061091d9060608601908601611250565b6001600160a01b03166109366040860160208701611250565b6001600160a01b03167f311b587a90667a06f2b2f1caf9c6c91dd0e9673ab4e5f1d57584a53501176337868660405161097092919061153e565b60405180910390a492915050565b6000546001600160a01b031633146109a85760405162461bcd60e51b81526004016104d390611559565b6109b26000610f87565b565b6000546001600160a01b031633146109de5760405162461bcd60e51b81526004016104d390611559565b816001600160a01b03166342842e0e30610a006000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b158015610a4f57600080fd5b505af1158015610a63573d6000803e3d6000fd5b505050505050565b6000546001600160a01b03163314610a955760405162461bcd60e51b81526004016104d390611559565b816001600160a01b031663a9059cbb610ab66000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610b03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b27919061126d565b505050565b6000546001600160a01b03163314610b565760405162461bcd60e51b81526004016104d390611559565b6001600160a01b038116610bbb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104d3565b610bc481610f87565b50565b42836080013511610beb576040516357e43f8f60e01b815260040160405180910390fd5b6000610bff6100ef368690038601866110ac565b90506000808060005b85811015610ece57868682818110610c2257610c2261128f565b9050602002810190610c34919061158e565b610c429060208101906112c5565b610c4d9150856115a4565b9350868682818110610c6157610c6161128f565b9050602002810190610c73919061158e565b610c81906020810190611250565b925060005b878783818110610c9857610c9861128f565b9050602002810190610caa919061158e565b610cb89060208101906112c5565b9050811015610ebb57878783818110610cd357610cd361128f565b9050602002810190610ce5919061158e565b610cf39060208101906112c5565b82818110610d0357610d0361128f565b905060200201359250886000016020810190610d1f9190611250565b604051623184cb60e71b81526001600160a01b0386811660048301526024820186905291909116906318c2658090604401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d91919061126d565b610dc057604051636812d8d960e01b81526001600160a01b0385166004820152602481018490526044016104d3565b6040516331a9108f60e11b8152600481018490526001600160a01b038516906342842e0e908290636352211e90602401602060405180830381865afa158015610e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3191906115bc565b610e4160608d0160408e01611250565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101869052606401600060405180830381600087803b158015610e9057600080fd5b505af1158015610ea4573d6000803e3d6000fd5b505050508080610eb39061132c565b915050610c86565b5080610ec68161132c565b915050610c08565b5060008481526001602052604081208054859290610eed9084906115d9565b90915550610f0390506040880160208901611250565b6001600160a01b03166340c10f1933610f208660608c01356115f0565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610f6657600080fd5b505af1158015610f7a573d6000803e3d6000fd5b5050505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060a08284031215610fe957600080fd5b50919050565b600060a0828403121561100157600080fd5b61100b8383610fd7565b9392505050565b6000806020838503121561102557600080fd5b823567ffffffffffffffff8082111561103d57600080fd5b818501915085601f83011261105157600080fd5b81358181111561106057600080fd5b8660208260051b850101111561107557600080fd5b60209290920196919550909350505050565b6001600160a01b0381168114610bc457600080fd5b80356110a781611087565b919050565b600060a082840312156110be57600080fd5b60405160a0810181811067ffffffffffffffff821117156110ef57634e487b7160e01b600052604160045260246000fd5b60405282356110fd81611087565b8152602083013561110d81611087565b602082015261111e6040840161109c565b604082015260608301356060820152608083013560808201528091505092915050565b60008060008060006080868803121561115957600080fd5b853561116481611087565b9450602086013561117481611087565b935060408601359250606086013567ffffffffffffffff8082111561119857600080fd5b818801915088601f8301126111ac57600080fd5b8135818111156111bb57600080fd5b8960208285010111156111cd57600080fd5b9699959850939650602001949392505050565b60008060c083850312156111f357600080fd5b6111fd8484610fd7565b9460a0939093013593505050565b60006020828403121561121d57600080fd5b5035919050565b6000806040838503121561123757600080fd5b823561124281611087565b946020939093013593505050565b60006020828403121561126257600080fd5b813561100b81611087565b60006020828403121561127f57600080fd5b8151801515811461100b57600080fd5b634e487b7160e01b600052603260045260246000fd5b6000823560be198336030181126112bb57600080fd5b9190910192915050565b6000808335601e198436030181126112dc57600080fd5b83018035915067ffffffffffffffff8211156112f757600080fd5b6020019150600581901b360382131561130f57600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b600060001982141561134057611340611316565b5060010190565b803561135281611087565b6001600160a01b03908116835260208201359061136e82611087565b908116602084015260408201359061138582611087565b16604083015260608181013590830152608090810135910152565b6000808335601e198436030181126113b757600080fd5b830160208101925035905067ffffffffffffffff8111156113d757600080fd5b8060051b360383131561130f57600080fd5b60208082528181018390526000906040808401600586811b8601830188865b8981101561151657888303603f190185528135368c900360be1901811261142e57600080fd5b8b0160c084810161143f8684611347565b60a061144d818501856113a0565b9188019390935290819052915060e08086019183881b8701909101908060005b858110156114ff5788840360df19018552823536839003603e1901811261149357600080fd5b820180356114a081611087565b6001600160a01b031685526114b7818f01826113a0565b91508d8f870152818e870152606060018060fb1b038311156114d857600080fd5b918c1b9182828883013760009690920190910194855250938c0193918c019160010161146d565b505050968901969450505090860190600101611408565b50909998505050505050505050565b60006020828403121561153757600080fd5b5051919050565b60c0810161154c8285611347565b8260a08301529392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008235603e198336030181126112bb57600080fd5b600082198211156115b7576115b7611316565b500190565b6000602082840312156115ce57600080fd5b815161100b81611087565b6000828210156115eb576115eb611316565b500390565b600081600019048311821515161561160a5761160a611316565b50029056fea26469706673582212203bd3994ae6b68befea92efbbb12bac9859c49e0cebdea71891df5ec05980e83564736f6c634300080b0033000000000000000000000000bc9a52a09145a4010c5babadc01626116f9f81e2
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063715018a611610071578063715018a614610166578063819d4cc61461016e5780638980f11f146101815780638da5cb5b146101945780639ce874ca146101af578063f2fde38b146101d657600080fd5b806302f27e0e146100b95780630bf71eaa146100ce578063137e71bc146100e1578063150b7a02146101075780632498f6be1461013357806352484ce714610146575b600080fd5b6100cc6100c7366004610fef565b6101e9565b005b6100cc6100dc366004611012565b6102fa565b6100f46100ef3660046110ac565b6103b3565b6040519081526020015b60405180910390f35b61011a610115366004611141565b610423565b6040516001600160e01b031990911681526020016100fe565b6100f46101413660046111e0565b61065e565b6100f461015436600461120b565b60016020526000908152604090205481565b6100cc61097e565b6100cc61017c366004611224565b6109b4565b6100cc61018f366004611224565b610a6b565b6000546040516001600160a01b0390911681526020016100fe565b6100f47f905b807fd353aab92fff351b55040687635f0d63b4a6cd2b6e76c9d9a00f842b81565b6100cc6101e4366004611250565b610b2c565b6101f96040820160208301611250565b604051632474521560e21b81527f905b807fd353aab92fff351b55040687635f0d63b4a6cd2b6e76c9d9a00f842b60048201523360248201526001600160a01b0391909116906391d1485490604401602060405180830381865afa158015610265573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610289919061126d565b6102a657604051637dae284b60e11b815260040160405180910390fd5b60006102ba6100ef368490038401846110ac565b6000818152600160205260408082208290555191925082917f309afd4ca07b05731ae3bb9970df23cf3f33f474cbcbc6e2252269393ac7b1389190a25050565b60005b818110156103755761036383838381811061031a5761031a61128f565b905060200281019061032c91906112a5565b84848481811061033e5761033e61128f565b905060200281019061035091906112a5565b61035e9060a08101906112c5565b610bc7565b8061036d8161132c565b9150506102fd565b507fbfb56d0cbcb870da34ed8cc0bddc87c7d0312cab02a96d5a48bad91fe76f1e8782826040516103a79291906113e9565b60405180910390a15050565b600081604051602001610406919081516001600160a01b03908116825260208084015182169083015260408084015190911690820152606080830151908201526080918201519181019190915260a00190565b604051602081830303815290604052805190602001209050919050565b600080610432838501856110ac565b9050600061043f826103b3565b8251604051623184cb60e71b8152336004820152602481018990529192506001600160a01b0316906318c2658090604401602060405180830381865afa15801561048d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104b1919061126d565b6104dc57604051636812d8d960e01b8152336004820152602481018790526044015b60405180910390fd5b4282608001511115806104fb5750600081815260016020526040902054155b15610519576040516357e43f8f60e01b815260040160405180910390fd5b6000818152600160209081526040918290208054600019019055830151606084015191516340c10f1960e01b81526001600160a01b038a8116600483015260248201939093529116906340c10f1990604401600060405180830381600087803b15801561058557600080fd5b505af1158015610599573d6000803e3d6000fd5b505050506040828101519051632142170760e11b81523060048201526001600160a01b0390911660248201526044810187905233906342842e0e90606401600060405180830381600087803b1580156105f157600080fd5b505af1158015610605573d6000803e3d6000fd5b5050604080518481523360208201529081018990527f091df57229697c69000d4036c8c123d47d4b61cbb946bdbeaa454f31a560a0449250606001905060405180910390a150630a85bd0160e11b979650505050505050565b6000428360800135111580610671575081155b1561068f576040516331d2cf1960e21b815260040160405180910390fd5b61069f6040840160208501611250565b6001600160a01b03166391d148546106bd6040860160208701611250565b6001600160a01b031663d53913936040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071e9190611525565b6040516001600160e01b031960e084901b1681526004810191909152336024820152604401602060405180830381865afa158015610760573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610784919061126d565b6107a15760405163079a505160e21b815260040160405180910390fd5b6107b16040840160208501611250565b6001600160a01b03166391d148546107cf6040860160208701611250565b6001600160a01b031663d53913936040518163ffffffff1660e01b8152600401602060405180830381865afa15801561080c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108309190611525565b6040516001600160e01b031960e084901b1681526004810191909152306024820152604401602060405180830381865afa158015610872573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610896919061126d565b6108b357604051630a2e65bd60e11b815260040160405180910390fd5b6108c56100ef368590038501856110ac565b600081815260016020526040902054909150156108f8576040516001624668f760e01b0319815260040160405180910390fd5b60008181526001602052604090819020839055819061091d9060608601908601611250565b6001600160a01b03166109366040860160208701611250565b6001600160a01b03167f311b587a90667a06f2b2f1caf9c6c91dd0e9673ab4e5f1d57584a53501176337868660405161097092919061153e565b60405180910390a492915050565b6000546001600160a01b031633146109a85760405162461bcd60e51b81526004016104d390611559565b6109b26000610f87565b565b6000546001600160a01b031633146109de5760405162461bcd60e51b81526004016104d390611559565b816001600160a01b03166342842e0e30610a006000546001600160a01b031690565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101849052606401600060405180830381600087803b158015610a4f57600080fd5b505af1158015610a63573d6000803e3d6000fd5b505050505050565b6000546001600160a01b03163314610a955760405162461bcd60e51b81526004016104d390611559565b816001600160a01b031663a9059cbb610ab66000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303816000875af1158015610b03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b27919061126d565b505050565b6000546001600160a01b03163314610b565760405162461bcd60e51b81526004016104d390611559565b6001600160a01b038116610bbb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104d3565b610bc481610f87565b50565b42836080013511610beb576040516357e43f8f60e01b815260040160405180910390fd5b6000610bff6100ef368690038601866110ac565b90506000808060005b85811015610ece57868682818110610c2257610c2261128f565b9050602002810190610c34919061158e565b610c429060208101906112c5565b610c4d9150856115a4565b9350868682818110610c6157610c6161128f565b9050602002810190610c73919061158e565b610c81906020810190611250565b925060005b878783818110610c9857610c9861128f565b9050602002810190610caa919061158e565b610cb89060208101906112c5565b9050811015610ebb57878783818110610cd357610cd361128f565b9050602002810190610ce5919061158e565b610cf39060208101906112c5565b82818110610d0357610d0361128f565b905060200201359250886000016020810190610d1f9190611250565b604051623184cb60e71b81526001600160a01b0386811660048301526024820186905291909116906318c2658090604401602060405180830381865afa158015610d6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d91919061126d565b610dc057604051636812d8d960e01b81526001600160a01b0385166004820152602481018490526044016104d3565b6040516331a9108f60e11b8152600481018490526001600160a01b038516906342842e0e908290636352211e90602401602060405180830381865afa158015610e0d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3191906115bc565b610e4160608d0160408e01611250565b6040516001600160e01b031960e085901b1681526001600160a01b0392831660048201529116602482015260448101869052606401600060405180830381600087803b158015610e9057600080fd5b505af1158015610ea4573d6000803e3d6000fd5b505050508080610eb39061132c565b915050610c86565b5080610ec68161132c565b915050610c08565b5060008481526001602052604081208054859290610eed9084906115d9565b90915550610f0390506040880160208901611250565b6001600160a01b03166340c10f1933610f208660608c01356115f0565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401600060405180830381600087803b158015610f6657600080fd5b505af1158015610f7a573d6000803e3d6000fd5b5050505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600060a08284031215610fe957600080fd5b50919050565b600060a0828403121561100157600080fd5b61100b8383610fd7565b9392505050565b6000806020838503121561102557600080fd5b823567ffffffffffffffff8082111561103d57600080fd5b818501915085601f83011261105157600080fd5b81358181111561106057600080fd5b8660208260051b850101111561107557600080fd5b60209290920196919550909350505050565b6001600160a01b0381168114610bc457600080fd5b80356110a781611087565b919050565b600060a082840312156110be57600080fd5b60405160a0810181811067ffffffffffffffff821117156110ef57634e487b7160e01b600052604160045260246000fd5b60405282356110fd81611087565b8152602083013561110d81611087565b602082015261111e6040840161109c565b604082015260608301356060820152608083013560808201528091505092915050565b60008060008060006080868803121561115957600080fd5b853561116481611087565b9450602086013561117481611087565b935060408601359250606086013567ffffffffffffffff8082111561119857600080fd5b818801915088601f8301126111ac57600080fd5b8135818111156111bb57600080fd5b8960208285010111156111cd57600080fd5b9699959850939650602001949392505050565b60008060c083850312156111f357600080fd5b6111fd8484610fd7565b9460a0939093013593505050565b60006020828403121561121d57600080fd5b5035919050565b6000806040838503121561123757600080fd5b823561124281611087565b946020939093013593505050565b60006020828403121561126257600080fd5b813561100b81611087565b60006020828403121561127f57600080fd5b8151801515811461100b57600080fd5b634e487b7160e01b600052603260045260246000fd5b6000823560be198336030181126112bb57600080fd5b9190910192915050565b6000808335601e198436030181126112dc57600080fd5b83018035915067ffffffffffffffff8211156112f757600080fd5b6020019150600581901b360382131561130f57600080fd5b9250929050565b634e487b7160e01b600052601160045260246000fd5b600060001982141561134057611340611316565b5060010190565b803561135281611087565b6001600160a01b03908116835260208201359061136e82611087565b908116602084015260408201359061138582611087565b16604083015260608181013590830152608090810135910152565b6000808335601e198436030181126113b757600080fd5b830160208101925035905067ffffffffffffffff8111156113d757600080fd5b8060051b360383131561130f57600080fd5b60208082528181018390526000906040808401600586811b8601830188865b8981101561151657888303603f190185528135368c900360be1901811261142e57600080fd5b8b0160c084810161143f8684611347565b60a061144d818501856113a0565b9188019390935290819052915060e08086019183881b8701909101908060005b858110156114ff5788840360df19018552823536839003603e1901811261149357600080fd5b820180356114a081611087565b6001600160a01b031685526114b7818f01826113a0565b91508d8f870152818e870152606060018060fb1b038311156114d857600080fd5b918c1b9182828883013760009690920190910194855250938c0193918c019160010161146d565b505050968901969450505090860190600101611408565b50909998505050505050505050565b60006020828403121561153757600080fd5b5051919050565b60c0810161154c8285611347565b8260a08301529392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008235603e198336030181126112bb57600080fd5b600082198211156115b7576115b7611316565b500190565b6000602082840312156115ce57600080fd5b815161100b81611087565b6000828210156115eb576115eb611316565b500390565b600081600019048311821515161561160a5761160a611316565b50029056fea26469706673582212203bd3994ae6b68befea92efbbb12bac9859c49e0cebdea71891df5ec05980e83564736f6c634300080b0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000bc9a52a09145a4010c5babadc01626116f9f81e2
-----Decoded View---------------
Arg [0] : owner (address): 0xBC9a52A09145a4010C5BABaDC01626116f9F81E2
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000bc9a52a09145a4010c5babadc01626116f9f81e2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.