Feature Tip: Add private address tag to any address under My Name Tag !
Source Code
Overview
ETH Balance
0 ETH
Eth Value
$0.00Latest 25 from a total of 96 transactions
| Transaction Hash |
Method
|
Block
|
From
|
|
To
|
||||
|---|---|---|---|---|---|---|---|---|---|
| Match Offer | 19743241 | 671 days ago | IN | 0 ETH | 0.00116347 | ||||
| Match Offer | 17845182 | 937 days ago | IN | 0 ETH | 0.00259455 | ||||
| Match Offer | 17783250 | 946 days ago | IN | 0 ETH | 0.00275576 | ||||
| Match Offer | 17775104 | 947 days ago | IN | 0 ETH | 0.00248286 | ||||
| Match Offer | 16852796 | 1077 days ago | IN | 0 ETH | 0.00239702 | ||||
| Match Offer | 16813050 | 1082 days ago | IN | 0 ETH | 0.00310741 | ||||
| Match Offer | 16677095 | 1101 days ago | IN | 0 ETH | 0.00460399 | ||||
| Match Offer | 16677005 | 1101 days ago | IN | 0 ETH | 0.00439227 | ||||
| Match Offer | 16648382 | 1106 days ago | IN | 0 ETH | 0.00334941 | ||||
| Match Offer | 16648024 | 1106 days ago | IN | 0 ETH | 0.00344257 | ||||
| Match Offer | 16639211 | 1107 days ago | IN | 0 ETH | 0.00443131 | ||||
| Match Offer | 16634190 | 1107 days ago | IN | 0 ETH | 0.00467598 | ||||
| Match Offer | 16634035 | 1108 days ago | IN | 0 ETH | 0.00501462 | ||||
| Match Offer | 16633996 | 1108 days ago | IN | 0 ETH | 0.00313399 | ||||
| Match Offer | 16589803 | 1114 days ago | IN | 0 ETH | 0.00333563 | ||||
| Match Offer | 16576825 | 1116 days ago | IN | 0 ETH | 0.00399836 | ||||
| Match Offer | 16576427 | 1116 days ago | IN | 0 ETH | 0.00316331 | ||||
| Match Offer | 16548998 | 1119 days ago | IN | 0 ETH | 0.00480668 | ||||
| Match Offer | 16547831 | 1120 days ago | IN | 0 ETH | 0.00254662 | ||||
| Match Offer | 16547761 | 1120 days ago | IN | 0 ETH | 0.00292609 | ||||
| Match Offer | 16546670 | 1120 days ago | IN | 0 ETH | 0.00273973 | ||||
| Match Offer | 16545970 | 1120 days ago | IN | 0 ETH | 0.00351797 | ||||
| Match Offer | 16524786 | 1123 days ago | IN | 0 ETH | 0.00214089 | ||||
| Match Offer | 16524777 | 1123 days ago | IN | 0 ETH | 0.00242423 | ||||
| Match Offer | 16517466 | 1124 days ago | IN | 0 ETH | 0.00082162 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers.
Latest 25 internal transactions (View All)
Advanced mode:
| Parent Transaction Hash | Method | Block |
From
|
|
To
|
|||
|---|---|---|---|---|---|---|---|---|
| Transfer From | 19743241 | 671 days ago | 0 ETH | |||||
| Safe Transfer Fr... | 19743241 | 671 days ago | 0 ETH | |||||
| Transfer From | 19743241 | 671 days ago | 0 ETH | |||||
| Transfer From | 19743241 | 671 days ago | 0 ETH | |||||
| Transfer From | 19743241 | 671 days ago | 0 ETH | |||||
| Royalty Info | 19743241 | 671 days ago | 0 ETH | |||||
| Allowance | 19743241 | 671 days ago | 0 ETH | |||||
| Balance Of | 19743241 | 671 days ago | 0 ETH | |||||
| Transfer* | 19743241 | 671 days ago | 0 ETH | |||||
| Is Approved For ... | 19743241 | 671 days ago | 0 ETH | |||||
| Balance Of | 19743241 | 671 days ago | 0 ETH | |||||
| Transfer* | 19743241 | 671 days ago | 0 ETH | |||||
| Transfer From | 17845182 | 937 days ago | 0 ETH | |||||
| Safe Transfer Fr... | 17845182 | 937 days ago | 0 ETH | |||||
| Transfer From | 17845182 | 937 days ago | 0 ETH | |||||
| Transfer From | 17845182 | 937 days ago | 0 ETH | |||||
| Transfer From | 17845182 | 937 days ago | 0 ETH | |||||
| Royalty Info | 17845182 | 937 days ago | 0 ETH | |||||
| Allowance | 17845182 | 937 days ago | 0 ETH | |||||
| Balance Of | 17845182 | 937 days ago | 0 ETH | |||||
| Transfer* | 17845182 | 937 days ago | 0 ETH | |||||
| Is Approved For ... | 17845182 | 937 days ago | 0 ETH | |||||
| Balance Of | 17845182 | 937 days ago | 0 ETH | |||||
| Transfer* | 17845182 | 937 days ago | 0 ETH | |||||
| Transfer From | 17783250 | 946 days ago | 0 ETH |
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions
Loading...
Loading
Contract Name:
NFTStraymMarket
Compiler Version
v0.8.9+commit.e5eed63a
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/utils/Counters.sol";
import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import '@openzeppelin/contracts/interfaces/IERC2981.sol';
contract NFTStraymMarket is Ownable, EIP712 {
using Counters for Counters.Counter;
Counters.Counter private _itemIds; //total number of items ever created
Counters.Counter private _itemsSold; //total number of items sold
IERC20 public immutable WETH;
address public commissionAddress;
uint8 public commissionPercent = 0;
uint8 constant sellOfferType = 0;
uint8 constant buyOfferType = 1;
uint8 constant priceTypeExact = 0;
uint8 constant priceTypeMinMax = 1;
uint256 constant zeroGas = 0;
uint256 constant INITIAL_FEE = 21000;
bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
bytes32 constant MESSAGE_TYPEHASH = keccak256(
"Message(address offerer,address token,uint256 tokenId,uint256 price,uint256 priceType,uint256 amount,uint256 offerType)"
);
constructor(
address _WETH, address _commissionAddress, uint8 _commissionPercent
) EIP712("Straym Marketplace", "1") {
WETH = IERC20(_WETH);
commissionAddress = _commissionAddress;
commissionPercent = _commissionPercent;
}
struct SellOffer {
address seller;
uint256 price;
uint8 priceType;
uint256 amount;
bytes signature;
}
struct BuyOffer {
address buyer;
uint256 price;
uint8 priceType;
uint256 amount;
bytes signature;
}
struct OfferToken {
address tokenAddress;
uint256 tokenId;
uint256 price;
uint256 amount;
}
struct Message {
address offerer;
address token;
uint256 tokenId;
uint256 price;
uint8 priceType;
uint256 amount;
uint8 offerType;
}
//log message (when Item is sold)
event MarketItemSelled (
uint indexed itemId,
address indexed tokenAddress,
uint256 indexed tokenId,
address seller,
address owner,
uint256 price,
uint256 amount,
bool sold
);
modifier checkSellSignature(
SellOffer memory sellOffer,
OfferToken memory offerToken
) {
bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
MESSAGE_TYPEHASH,
sellOffer.seller,
offerToken.tokenAddress,
offerToken.tokenId,
sellOffer.price,
sellOffer.priceType,
sellOffer.amount,
sellOfferType
)));
address signer = ECDSA.recover(digest, sellOffer.signature);
require(signer == sellOffer.seller , 'wrong sell offer signature');
_;
}
modifier checkSellerNFTPermission(
OfferToken memory offer,
address seller
) {
require(IERC1155(offer.tokenAddress).balanceOf(seller, offer.tokenId) >= offer.amount, "Seller is not owner enough NFTs");
require(IERC1155(offer.tokenAddress).isApprovedForAll(seller, address(this)), "Marketplace do not have permission to transfer this NFT");
_;
}
modifier checkBuySignature(
BuyOffer memory buyOffer,
OfferToken memory offerToken
) {
bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
MESSAGE_TYPEHASH,
buyOffer.buyer,
offerToken.tokenAddress,
offerToken.tokenId,
buyOffer.price,
buyOffer.priceType,
buyOffer.amount,
buyOfferType
)));
address signer = ECDSA.recover(digest, buyOffer.signature);
require(signer == buyOffer.buyer , 'wrong buy offer signature');
_;
}
modifier checkGasFee(
uint256 gasLimit
) {
require(gasleft() <= gasLimit, "Gas fee is greater than gas limit");
_;
}
modifier checkBuyerWETH(
address buyer,
uint256 matchPrice,
uint256 amount,
uint256 gasLimit
) {
require(IERC20(WETH).balanceOf(buyer) >= ((matchPrice * amount) + gasLimit), "Please submit the asking price in order to complete purchase");
require(IERC20(WETH).allowance(buyer, address(this)) >= ((matchPrice * amount) + gasLimit), "Please allow the asking WETH in order to complete purchase");
_;
}
modifier checkMatchWETH(
uint256 matchPrice,
uint256 sellPrice,
uint256 buyPrice,
uint8 sellPriceType,
uint8 buyPriceType
) {
require(sellPriceType == priceTypeExact || sellPriceType == priceTypeMinMax, "Sell price type not valid");
require(buyPriceType == priceTypeExact || buyPriceType == priceTypeMinMax, "Buy price type not valid");
if (sellPriceType == priceTypeExact) {
require(matchPrice == sellPrice, "Match price not equal to sell price");
}
if (buyPriceType == priceTypeExact) {
require(matchPrice == buyPrice, "Match price not equal to buy price");
}
if (sellPriceType == priceTypeMinMax) {
require(matchPrice >= sellPrice, "Match price must be greater than min sell price");
}
if (buyPriceType == priceTypeMinMax) {
require(buyPrice >= matchPrice, "Match price must be less than max buy price");
}
_;
}
modifier checkMatchAmount(
uint256 sellAmount,
uint256 buyAmount,
uint256 matchAmount
) {
require(matchAmount <= sellAmount && matchAmount <= buyAmount, "Match amount not valid");
_;
}
modifier checkBuyerETH(
OfferToken memory offer
) {
require(msg.value >= offer.price * offer.amount, 'Insufficient funds!');
_;
}
function _verifySellOffer(
SellOffer memory sellOffer,
OfferToken memory offerToken
)
private view
checkSellSignature(sellOffer,offerToken)
checkSellerNFTPermission(offerToken, sellOffer.seller)
returns (bool)
{
return true;
}
function _verifyBuyOffer(
BuyOffer memory buyOffer,
OfferToken memory offerToken,
uint256 gasLimit
)
private view
checkBuySignature(buyOffer, offerToken)
checkBuyerWETH(buyOffer.buyer, offerToken.price, offerToken.amount, gasLimit)
returns (bool)
{
return true;
}
function _verifyMatchOffer(
SellOffer memory _sellOffer,
BuyOffer memory _buyOffer,
OfferToken memory _offerToken
)
private pure
checkMatchWETH(_offerToken.price, _sellOffer.price, _buyOffer.price, _sellOffer.priceType, _buyOffer.priceType)
checkMatchAmount(_sellOffer.amount, _buyOffer.amount, _offerToken.amount)
returns (bool)
{
return true;
}
function _verifyOffer(
SellOffer memory sellOffer,
BuyOffer memory buyOffer,
OfferToken memory offerToken,
uint256 gasLimit
)
private view
{
_verifySellOffer(sellOffer, offerToken);
_verifyBuyOffer(buyOffer, offerToken, gasLimit);
_verifyMatchOffer(sellOffer, buyOffer, offerToken);
}
modifier _refundGasCost(
address offerBuyer,
uint256 gasLimit
)
{
uint remainingGasStart = gasleft();
_;
uint remainingGasEnd = gasleft();
uint usedGas = remainingGasStart - remainingGasEnd;
// Add intrinsic gas and transfer gas. Need to account for gas stipend as well.
usedGas += INITIAL_FEE + 16000;
// usedGas += 21000 + 9000;
// Possibly need to check max gasprice and usedGas here to limit possibility for abuse.
uint gasCost = usedGas * (tx.gasprice + block.basefee);
require(gasCost <= gasLimit, "Gas fee is greater than gas limit");
// Refund gas cost
IERC20(WETH).transferFrom(offerBuyer, _msgSender(), gasCost);
}
function matchOffer(
SellOffer memory sellOffer,
BuyOffer memory buyOffer,
OfferToken memory offerToken,
uint256 gasLimit
)
public
onlyOwner
_refundGasCost(buyOffer.buyer, gasLimit)
{
_verifyOffer(sellOffer, buyOffer, offerToken, gasLimit);
_matchOffer(sellOffer, buyOffer, offerToken);
}
function _matchOffer(
SellOffer memory sellOffer,
BuyOffer memory buyOffer,
OfferToken memory offerToken
)
private
{
address offerSeller = sellOffer.seller;
address offerBuyer = buyOffer.buyer;
uint256 matchPrice = offerToken.price;
uint256 offerAmount = offerToken.amount;
address tokenAddress = offerToken.tokenAddress;
uint256 tokenId = offerToken.tokenId;
_transferWETH(offerSeller, offerBuyer, tokenAddress, tokenId, matchPrice, offerAmount);
_transferNFTs(offerSeller, offerBuyer, tokenAddress, tokenId, matchPrice, offerAmount);
}
function _transferWETH(
address offerSeller,
address offerBuyer,
address tokenAddress,
uint256 tokenId,
uint256 offerPrice,
uint256 offerAmount
)
private
{
uint256 offerTotalPrice = offerPrice * offerAmount;
// commision amount
uint256 commissionAmount = offerTotalPrice * commissionPercent / 100;
uint256 sellerReceiveAmount;
(address royaltiesReceiver, uint256 royaltiesAmount) = getRoyaltyInfo(tokenAddress, tokenId, offerTotalPrice);
sellerReceiveAmount = offerTotalPrice - (commissionAmount / 2);
if (royaltiesAmount > 0) {
sellerReceiveAmount = sellerReceiveAmount - (royaltiesAmount / 2);
}
//pay the seller the amount
IERC20(WETH).transferFrom(offerBuyer, offerSeller, sellerReceiveAmount);
//pay commission
IERC20(WETH).transferFrom(offerBuyer, commissionAddress, commissionAmount);
//pay royalties
IERC20(WETH).transferFrom(offerBuyer, royaltiesReceiver, royaltiesAmount);
}
function _transferETH(
address offerSeller,
address tokenAddress,
uint256 tokenId,
uint256 offerPrice,
uint256 offerAmount
)
public
payable
{
uint256 offerTotalPrice = offerPrice * offerAmount;
// commision amount
uint256 commissionAmount = offerTotalPrice * commissionPercent / 100;
uint256 sellerReceiveAmount = offerTotalPrice - commissionAmount;
(address royaltiesReceiver, uint256 royaltiesAmount) = getRoyaltyInfo(tokenAddress, tokenId, offerTotalPrice);
if (royaltiesAmount > 0) {
sellerReceiveAmount = sellerReceiveAmount - royaltiesAmount;
}
payable(offerSeller).transfer(sellerReceiveAmount);
//pay commission
payable(commissionAddress).transfer(commissionAmount);
//pay royalties
payable(royaltiesReceiver).transfer(royaltiesAmount);
}
function _transferNFTs(
address offerSeller,
address offerBuyer,
address tokenAddress,
uint256 tokenId,
uint256 offerPrice,
uint256 offerAmount
)
private
{
//transfer ownership of the nft from the contract itself to the buyer
IERC1155(tokenAddress).safeTransferFrom(offerSeller, offerBuyer, tokenId, offerAmount, '');
_itemIds.increment(); //add 1 to the total number of items ever created
uint256 itemId = _itemIds.current();
emit MarketItemSelled(
itemId,
tokenAddress,
tokenId,
offerSeller,
offerBuyer,
offerPrice,
offerAmount,
false
);
}
function acceptSellOffer(
SellOffer memory sellOffer,
OfferToken memory offerToken
)
public
payable
checkSellSignature(sellOffer,offerToken)
checkSellerNFTPermission(offerToken, sellOffer.seller)
checkBuyerETH(offerToken)
{
address offerSeller = sellOffer.seller;
address offerBuyer = _msgSender();
uint256 offerAmount = offerToken.amount;
uint256 offerTokenId = offerToken.tokenId;
address offerTokenAddress = offerToken.tokenAddress;
uint256 offerPrice = sellOffer.price;
_transferETH(offerSeller, offerTokenAddress, offerTokenId, offerPrice, offerAmount);
//transfer ownership of the nft from the contract itself to the buyer
IERC1155(offerTokenAddress).safeTransferFrom(offerSeller, offerBuyer, offerTokenId, offerAmount, '');
_itemIds.increment(); //add 1 to the total number of items ever created
uint256 itemId = _itemIds.current();
emit MarketItemSelled(
itemId,
offerTokenAddress,
offerTokenId,
offerSeller,
offerBuyer,
offerPrice,
offerAmount,
false
);
}
function acceptBuyOffer(
BuyOffer memory buyOffer,
OfferToken memory offerToken
)
public
payable
checkSellerNFTPermission(offerToken, _msgSender())
{
_verifyBuyOffer(buyOffer, offerToken, zeroGas);
address offerSeller = _msgSender();
address offerBuyer = buyOffer.buyer;
uint256 offerAmount = offerToken.amount;
uint256 offerTokenId = offerToken.tokenId;
address offerTokenAddress = offerToken.tokenAddress;
uint256 offerPrice = buyOffer.price;
_transferWETH(offerSeller, offerBuyer, offerTokenAddress, offerTokenId, offerPrice, offerAmount);
//transfer ownership of the nft from the contract itself to the buyer
IERC1155(offerTokenAddress).safeTransferFrom(offerSeller, offerBuyer, offerTokenId, offerAmount, '');
_itemIds.increment(); //add 1 to the total number of items ever created
uint256 itemId = _itemIds.current();
emit MarketItemSelled(
itemId,
offerTokenAddress,
offerTokenId,
offerSeller,
offerBuyer,
offerPrice,
offerAmount,
false
);
}
/// @notice Set new commission address
function setCommissionAddress(address _commissionAddress) public onlyOwner {
commissionAddress = _commissionAddress;
}
/// @notice Set new commission percent
function setCommissionPercent(uint8 _commissionPercent) public onlyOwner {
commissionPercent = _commissionPercent;
}
/// @notice Check for support royalties of token contract
function checkRoyalties(address _contract)
public
view
returns (bool)
{
(bool success) = IERC2981(_contract).
supportsInterface(_INTERFACE_ID_ERC2981);
return success;
}
/// @notice Get royalties info of token
function getRoyaltyInfo(address _tokenAddress, uint256 _tokenId, uint256 _salePrice)
public
view
returns (address receiver, uint256 royaltyAmount)
{
(address royaltiesReceiver, uint256 royaltiesAmount) = IERC2981(_tokenAddress)
.royaltyInfo(_tokenId, _salePrice);
return (royaltiesReceiver, royaltiesAmount);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol)
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
/**
* @dev Interface for the NFT Royalty Standard.
*
* A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal
* support for royalty payments across all NFT marketplaces and ecosystem participants.
*
* _Available since v4.5._
*/
interface IERC2981 is IERC165 {
/**
* @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of
* exchange. The royalty amount is denominated and should be paid in that same unit of exchange.
*/
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol)
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: address zero is not a valid owner");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner or approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not token owner or approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `ids` and `amounts` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
/**
* @dev Hook that is called after any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non-ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non-ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_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;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)
pragma solidity ^0.8.0;
/**
* @title Counters
* @author Matt Condon (@shrugs)
* @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
* of elements in a mapping, issuing ERC721 ids, or counting request ids.
*
* Include with `using Counters for Counters.Counter;`
*/
library Counters {
struct Counter {
// This variable should never be directly accessed by users of the library: interactions must be restricted to
// the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
// this feature: see https://github.com/ethereum/solidity/issues/4637
uint256 _value; // default: 0
}
function current(Counter storage counter) internal view returns (uint256) {
return counter._value;
}
function increment(Counter storage counter) internal {
unchecked {
counter._value += 1;
}
}
function decrement(Counter storage counter) internal {
uint256 value = counter._value;
require(value > 0, "Counter: decrement overflow");
unchecked {
counter._value = value - 1;
}
}
function reset(Counter storage counter) internal {
counter._value = 0;
}
}// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; // EIP-712 is Final as of 2022-08-11. This file is deprecated. import "./EIP712.sol";
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
import "../Strings.sol";
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV // Deprecated in v4.8
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
/// @solidity memory-safe-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol)
pragma solidity ^0.8.0;
import "./ECDSA.sol";
/**
* @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
*
* The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
* thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
* they need in their contracts using a combination of `abi.encode` and `keccak256`.
*
* This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
* scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
* ({_hashTypedDataV4}).
*
* The implementation of the domain separator was designed to be as efficient as possible while still properly updating
* the chain id to protect against replay attacks on an eventual fork of the chain.
*
* NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
* https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
*
* _Available since v3.4._
*/
abstract contract EIP712 {
/* solhint-disable var-name-mixedcase */
// Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
// invalidate the cached domain separator if the chain id changes.
bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
uint256 private immutable _CACHED_CHAIN_ID;
address private immutable _CACHED_THIS;
bytes32 private immutable _HASHED_NAME;
bytes32 private immutable _HASHED_VERSION;
bytes32 private immutable _TYPE_HASH;
/* solhint-enable var-name-mixedcase */
/**
* @dev Initializes the domain separator and parameter caches.
*
* The meaning of `name` and `version` is specified in
* https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
*
* - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
* - `version`: the current major version of the signing domain.
*
* NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
* contract upgrade].
*/
constructor(string memory name, string memory version) {
bytes32 hashedName = keccak256(bytes(name));
bytes32 hashedVersion = keccak256(bytes(version));
bytes32 typeHash = keccak256(
"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
);
_HASHED_NAME = hashedName;
_HASHED_VERSION = hashedVersion;
_CACHED_CHAIN_ID = block.chainid;
_CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
_CACHED_THIS = address(this);
_TYPE_HASH = typeHash;
}
/**
* @dev Returns the domain separator for the current chain.
*/
function _domainSeparatorV4() internal view returns (bytes32) {
if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
return _CACHED_DOMAIN_SEPARATOR;
} else {
return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
}
}
function _buildDomainSeparator(
bytes32 typeHash,
bytes32 nameHash,
bytes32 versionHash
) private view returns (bytes32) {
return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
}
/**
* @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
* function returns the hash of the fully encoded EIP712 message for this domain.
*
* This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
*
* ```solidity
* bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
* keccak256("Mail(address to,string contents)"),
* mailTo,
* keccak256(bytes(mailContents))
* )));
* address signer = ECDSA.recover(digest, signature);
* ```
*/
function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator
) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1);
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(
uint256 x,
uint256 y,
uint256 denominator,
Rounding rounding
) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10**64) {
value /= 10**64;
result += 64;
}
if (value >= 10**32) {
value /= 10**32;
result += 32;
}
if (value >= 10**16) {
value /= 10**16;
result += 16;
}
if (value >= 10**8) {
value /= 10**8;
result += 8;
}
if (value >= 10**4) {
value /= 10**4;
result += 4;
}
if (value >= 10**2) {
value /= 10**2;
result += 2;
}
if (value >= 10**1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_WETH","type":"address"},{"internalType":"address","name":"_commissionAddress","type":"address"},{"internalType":"uint8","name":"_commissionPercent","type":"uint8"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"itemId","type":"uint256"},{"indexed":true,"internalType":"address","name":"tokenAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"seller","type":"address"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"price","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"sold","type":"bool"}],"name":"MarketItemSelled","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":"WETH","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"offerSeller","type":"address"},{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"offerPrice","type":"uint256"},{"internalType":"uint256","name":"offerAmount","type":"uint256"}],"name":"_transferETH","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"priceType","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct NFTStraymMarket.BuyOffer","name":"buyOffer","type":"tuple"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct NFTStraymMarket.OfferToken","name":"offerToken","type":"tuple"}],"name":"acceptBuyOffer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"priceType","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct NFTStraymMarket.SellOffer","name":"sellOffer","type":"tuple"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct NFTStraymMarket.OfferToken","name":"offerToken","type":"tuple"}],"name":"acceptSellOffer","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_contract","type":"address"}],"name":"checkRoyalties","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commissionAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"commissionPercent","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenAddress","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_salePrice","type":"uint256"}],"name":"getRoyaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"priceType","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct NFTStraymMarket.SellOffer","name":"sellOffer","type":"tuple"},{"components":[{"internalType":"address","name":"buyer","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint8","name":"priceType","type":"uint8"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct NFTStraymMarket.BuyOffer","name":"buyOffer","type":"tuple"},{"components":[{"internalType":"address","name":"tokenAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct NFTStraymMarket.OfferToken","name":"offerToken","type":"tuple"},{"internalType":"uint256","name":"gasLimit","type":"uint256"}],"name":"matchOffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_commissionAddress","type":"address"}],"name":"setCommissionAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"_commissionPercent","type":"uint8"}],"name":"setCommissionPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
6101606040526003805460ff60a01b191690553480156200001f57600080fd5b50604051620026f2380380620026f28339810160408190526200004291620001de565b6040518060400160405280601281526020017153747261796d204d61726b6574706c61636560701b815250604051806040016040528060018152602001603160f81b815250620000a16200009b6200016d60201b60201c565b62000171565b815160208084019190912082518383012060e08290526101008190524660a0818152604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81880181905281830187905260608201869052608082019490945230818401528151808203909301835260c00190528051940193909320919290916080523060c05261012052505050506001600160a01b03928316610140526003805460ff909216600160a01b026001600160a81b0319909216929093169190911717905562000231565b3390565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001d957600080fd5b919050565b600080600060608486031215620001f457600080fd5b620001ff84620001c1565b92506200020f60208501620001c1565b9150604084015160ff811681146200022657600080fd5b809150509250925092565b60805160a05160c05160e05161010051610120516101405161243c620002b66000396000818161024d01528181610c5a01528181610ef901528181611021015281816111ba015281816112600152611304015260006115360152600061158501526000611560015260006114b9015260006114e30152600061150d015261243c6000f3fe6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063ad5c464811610059578063ad5c46481461023b578063c0a515871461026f578063ec9807bb1461029f578063f2fde38b146102bf57600080fd5b80638da5cb5b146101c95780638eefba6a146101fb578063931742d31461021b57600080fd5b806340fff80c116100bb57806340fff80c1461014e578063715018a61461016e57806377d3550b146101835780638c9b3acf146101b657600080fd5b806301678d04146100e25780632ef8a162146100f757806336de97421461010a575b600080fd5b6100f56100f036600461200e565b6102df565b005b6100f561010536600461200e565b61068c565b34801561011657600080fd5b5061012a61012536600461205d565b6108df565b604080516001600160a01b0390931683526020830191909152015b60405180910390f35b34801561015a57600080fd5b506100f5610169366004612092565b610974565b34801561017a57600080fd5b506100f561099e565b34801561018f57600080fd5b506003546101a490600160a01b900460ff1681565b60405160ff9091168152602001610145565b6100f56101c43660046120af565b6109b2565b3480156101d557600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610145565b34801561020757600080fd5b506100f5610216366004612100565b610ad3565b34801561022757600080fd5b506003546101e3906001600160a01b031681565b34801561024757600080fd5b506101e37f000000000000000000000000000000000000000000000000000000000000000081565b34801561027b57600080fd5b5061028f61028a366004612092565b610afb565b6040519015158152602001610145565b3480156102ab57600080fd5b506100f56102ba36600461211b565b610b85565b3480156102cb57600080fd5b506100f56102da366004612092565b610ced565b818160006103597fc8f4d2bc275da5ec1177ab31f368315d42f236b7d09cf0deecf8eaef842f7d9d846000015184600001518560200151876020015188604001518960600151600060405160200161033e989796959493929190612198565b60405160208183030381529060405280519060200120610d66565b9050600061036b828560800151610dba565b905083600001516001600160a01b0316816001600160a01b0316146103d75760405162461bcd60e51b815260206004820152601a60248201527f77726f6e672073656c6c206f66666572207369676e617475726500000000000060448201526064015b60405180910390fd5b8551606086015186516020880151604051627eeac760e11b8152899493926001600160a01b03169162fdd58e916104269186916004016001600160a01b03929092168252602082015260400190565b60206040518083038186803b15801561043e57600080fd5b505afa158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906121e0565b10156104945760405162461bcd60e51b81526004016103ce906121f9565b815160405163e985e9c560e01b81526001600160a01b0383811660048301523060248301529091169063e985e9c59060440160206040518083038186803b1580156104de57600080fd5b505afa1580156104f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105169190612230565b6105325760405162461bcd60e51b81526004016103ce90612252565b868060600151816040015161054791906122c5565b34101561058c5760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742066756e64732160681b60448201526064016103ce565b885160608901516020808b01518b51918d0151339392906105b086838584886109b2565b604051637921219560e11b81526001600160a01b0383169063f242432a906105e2908990899088908a906004016122e4565b600060405180830381600087803b1580156105fc57600080fd5b505af1158015610610573d6000803e3d6000fd5b50505050610622600180546001019055565b600061062d60015490565b905083836001600160a01b0316827e2fb2c9a8cec93e6d7e0ff2630fefa002899dc3cbf4474e8a9c90ca31f992e78a8a878b600060405161067295949392919061231c565b60405180910390a450505050505050505050505050505050565b8033606082015182516020840151604051627eeac760e11b81526001600160a01b038581166004830152602482019290925291169062fdd58e9060440160206040518083038186803b1580156106e157600080fd5b505afa1580156106f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071991906121e0565b10156107375760405162461bcd60e51b81526004016103ce906121f9565b815160405163e985e9c560e01b81526001600160a01b0383811660048301523060248301529091169063e985e9c59060440160206040518083038186803b15801561078157600080fd5b505afa158015610795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b99190612230565b6107d55760405162461bcd60e51b81526004016103ce90612252565b6107e184846000610dde565b50835160608401516020808601518651918801513394939290610808868684868589611121565b604051637921219560e11b81526001600160a01b0383169063f242432a9061083a908990899088908a906004016122e4565b600060405180830381600087803b15801561085457600080fd5b505af1158015610868573d6000803e3d6000fd5b5050505061087a600180546001019055565b600061088560015490565b905083836001600160a01b0316827e2fb2c9a8cec93e6d7e0ff2630fefa002899dc3cbf4474e8a9c90ca31f992e78a8a878b60006040516108ca95949392919061231c565b60405180910390a45050505050505050505050565b60405163152a902d60e11b815260048101839052602481018290526000908190819081906001600160a01b03881690632a55205a90604401604080518083038186803b15801561092e57600080fd5b505afa158015610942573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610966919061234d565b909890975095505050505050565b61097c61139d565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6109a661139d565b6109b060006113f7565b565b60006109be82846122c5565b6003549091506000906064906109de90600160a01b900460ff16846122c5565b6109e8919061237b565b905060006109f6828461239d565b9050600080610a068989876108df565b90925090508015610a1e57610a1b818461239d565b92505b6040516001600160a01b038b169084156108fc029085906000818181858888f19350505050158015610a54573d6000803e3d6000fd5b506003546040516001600160a01b039091169085156108fc029086906000818181858888f19350505050158015610a8f573d6000803e3d6000fd5b506040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610ac6573d6000803e3d6000fd5b5050505050505050505050565b610adb61139d565b6003805460ff909216600160a01b0260ff60a01b19909216919091179055565b6040516301ffc9a760e01b815263152a902d60e11b600482015260009081906001600160a01b038416906301ffc9a79060240160206040518083038186803b158015610b4657600080fd5b505afa158015610b5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7e9190612230565b9392505050565b610b8d61139d565b82518160005a9050610ba187878787611447565b610bac878787611470565b60005a90506000610bbd828461239d565b9050610bcd615208613e806123b4565b610bd790826123b4565b90506000610be5483a6123b4565b610bef90836122c5565b905084811115610c4b5760405162461bcd60e51b815260206004820152602160248201527f476173206665652069732067726561746572207468616e20676173206c696d696044820152601d60fa1b60648201526084016103ce565b6040516323b872dd60e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd90610c9b908990339086906004016123cc565b602060405180830381600087803b158015610cb557600080fd5b505af1158015610cc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac69190612230565b610cf561139d565b6001600160a01b038116610d5a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103ce565b610d63816113f7565b50565b6000610db4610d736114ac565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b92915050565b6000806000610dc985856115d3565b91509150610dd681611619565b509392505050565b600083836000610e3f7fc8f4d2bc275da5ec1177ab31f368315d42f236b7d09cf0deecf8eaef842f7d9d846000015184600001518560200151876020015188604001518960600151600160405160200161033e989796959493929190612198565b90506000610e51828560800151610dba565b905083600001516001600160a01b0316816001600160a01b031614610eb85760405162461bcd60e51b815260206004820152601960248201527f77726f6e6720627579206f66666572207369676e61747572650000000000000060448201526064016103ce565b8751604088015160608901518880610ed083856122c5565b610eda91906123b4565b6040516370a0823160e01b81526001600160a01b0386811660048301527f000000000000000000000000000000000000000000000000000000000000000016906370a082319060240160206040518083038186803b158015610f3b57600080fd5b505afa158015610f4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7391906121e0565b1015610fe75760405162461bcd60e51b815260206004820152603c60248201527f506c65617365207375626d6974207468652061736b696e67207072696365206960448201527f6e206f7264657220746f20636f6d706c6574652070757263686173650000000060648201526084016103ce565b80610ff283856122c5565b610ffc91906123b4565b604051636eb1769f60e11b81526001600160a01b0386811660048301523060248301527f0000000000000000000000000000000000000000000000000000000000000000169063dd62ed3e9060440160206040518083038186803b15801561106357600080fd5b505afa158015611077573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109b91906121e0565b101561110f5760405162461bcd60e51b815260206004820152603a60248201527f506c6561736520616c6c6f77207468652061736b696e67205745544820696e2060448201527f6f7264657220746f20636f6d706c65746520707572636861736500000000000060648201526084016103ce565b5060019b9a5050505050505050505050565b600061112d82846122c5565b60035490915060009060649061114d90600160a01b900460ff16846122c5565b611157919061237b565b905060008060006111698989876108df565b909250905061117960028561237b565b611183908661239d565b925080156111a35761119660028261237b565b6111a0908461239d565b92505b6040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906111f3908d908f9088906004016123cc565b602060405180830381600087803b15801561120d57600080fd5b505af1158015611221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112459190612230565b506003546040516323b872dd60e01b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000008116926323b872dd9261129a928f92169089906004016123cc565b602060405180830381600087803b1580156112b457600080fd5b505af11580156112c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ec9190612230565b506040516323b872dd60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906323b872dd9061133d908d90869086906004016123cc565b602060405180830381600087803b15801561135757600080fd5b505af115801561136b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138f9190612230565b505050505050505050505050565b6000546001600160a01b031633146109b05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103ce565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6114518483611767565b5061145d838383610dde565b506114698484846119ab565b5050505050565b825182516040830151606084015184516020860151611493868684848888611121565b6114a1868684848888611c96565b505050505050505050565b6000306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614801561150557507f000000000000000000000000000000000000000000000000000000000000000046145b1561152f57507f000000000000000000000000000000000000000000000000000000000000000090565b50604080517f00000000000000000000000000000000000000000000000000000000000000006020808301919091527f0000000000000000000000000000000000000000000000000000000000000000828401527f000000000000000000000000000000000000000000000000000000000000000060608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008082516041141561160a5760208301516040840151606085015160001a6115fe87828585611d69565b94509450505050611612565b506000905060025b9250929050565b600081600481111561162d5761162d6123f0565b14156116365750565b600181600481111561164a5761164a6123f0565b14156116985760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103ce565b60028160048111156116ac576116ac6123f0565b14156116fa5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103ce565b600381600481111561170e5761170e6123f0565b1415610d635760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016103ce565b6000828260006117c87fc8f4d2bc275da5ec1177ab31f368315d42f236b7d09cf0deecf8eaef842f7d9d846000015184600001518560200151876020015188604001518960600151600060405160200161033e989796959493929190612198565b905060006117da828560800151610dba565b905083600001516001600160a01b0316816001600160a01b0316146118415760405162461bcd60e51b815260206004820152601a60248201527f77726f6e672073656c6c206f66666572207369676e617475726500000000000060448201526064016103ce565b8651606087015187516020890151604051627eeac760e11b81528a9493926001600160a01b03169162fdd58e916118909186916004016001600160a01b03929092168252602082015260400190565b60206040518083038186803b1580156118a857600080fd5b505afa1580156118bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e091906121e0565b10156118fe5760405162461bcd60e51b81526004016103ce906121f9565b815160405163e985e9c560e01b81526001600160a01b0383811660048301523060248301529091169063e985e9c59060440160206040518083038186803b15801561194857600080fd5b505afa15801561195c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119809190612230565b61199c5760405162461bcd60e51b81526004016103ce90612252565b50600198975050505050505050565b600081604001518460200151846020015186604001518660400151600060ff168260ff1614806119de575060ff82166001145b611a2a5760405162461bcd60e51b815260206004820152601960248201527f53656c6c2070726963652074797065206e6f742076616c69640000000000000060448201526064016103ce565b60ff81161580611a3d575060ff81166001145b611a895760405162461bcd60e51b815260206004820152601860248201527f4275792070726963652074797065206e6f742076616c6964000000000000000060448201526064016103ce565b60ff8216611aec57838514611aec5760405162461bcd60e51b815260206004820152602360248201527f4d61746368207072696365206e6f7420657175616c20746f2073656c6c20707260448201526269636560e81b60648201526084016103ce565b60ff8116611b4e57828514611b4e5760405162461bcd60e51b815260206004820152602260248201527f4d61746368207072696365206e6f7420657175616c20746f2062757920707269604482015261636560f01b60648201526084016103ce565b60ff821660011415611bc25783851015611bc25760405162461bcd60e51b815260206004820152602f60248201527f4d61746368207072696365206d7573742062652067726561746572207468616e60448201526e206d696e2073656c6c20707269636560881b60648201526084016103ce565b60ff811660011415611c325784831015611c325760405162461bcd60e51b815260206004820152602b60248201527f4d61746368207072696365206d757374206265206c657373207468616e206d6160448201526a782062757920707269636560a81b60648201526084016103ce565b886060015188606001518860600151828111158015611c515750818111155b61110f5760405162461bcd60e51b815260206004820152601660248201527513585d18da08185b5bdd5b9d081b9bdd081d985b1a5960521b60448201526064016103ce565b604051637921219560e11b81526001600160a01b0385169063f242432a90611cc89089908990889087906004016122e4565b600060405180830381600087803b158015611ce257600080fd5b505af1158015611cf6573d6000803e3d6000fd5b50505050611d08600180546001019055565b6000611d1360015490565b905083856001600160a01b0316827e2fb2c9a8cec93e6d7e0ff2630fefa002899dc3cbf4474e8a9c90ca31f992e78a8a88886000604051611d5895949392919061231c565b60405180910390a450505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611da05750600090506003611e24565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611df4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611e1d57600060019250925050611e24565b9150600090505b94509492505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715611e6657611e66611e2d565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611e9557611e95611e2d565b604052919050565b6001600160a01b0381168114610d6357600080fd5b803560ff81168114611ec357600080fd5b919050565b600060a08284031215611eda57600080fd5b611ee2611e43565b90508135611eef81611e9d565b815260208281013581830152611f0760408401611eb2565b604083015260608301356060830152608083013567ffffffffffffffff80821115611f3157600080fd5b818501915085601f830112611f4557600080fd5b813581811115611f5757611f57611e2d565b611f69601f8201601f19168501611e6c565b91508082528684828501011115611f7f57600080fd5b808484018584013760008482840101525080608085015250505092915050565b600060808284031215611fb157600080fd5b6040516080810181811067ffffffffffffffff82111715611fd457611fd4611e2d565b6040529050808235611fe581611e9d565b808252506020830135602082015260408301356040820152606083013560608201525092915050565b60008060a0838503121561202157600080fd5b823567ffffffffffffffff81111561203857600080fd5b61204485828601611ec8565b9250506120548460208501611f9f565b90509250929050565b60008060006060848603121561207257600080fd5b833561207d81611e9d565b95602085013595506040909401359392505050565b6000602082840312156120a457600080fd5b8135610b7e81611e9d565b600080600080600060a086880312156120c757600080fd5b85356120d281611e9d565b945060208601356120e281611e9d565b94979496505050506040830135926060810135926080909101359150565b60006020828403121561211257600080fd5b610b7e82611eb2565b60008060008060e0858703121561213157600080fd5b843567ffffffffffffffff8082111561214957600080fd5b61215588838901611ec8565b9550602087013591508082111561216b57600080fd5b5061217887828801611ec8565b9350506121888660408701611f9f565b9396929550929360c00135925050565b9788526001600160a01b0396871660208901529490951660408701526060860192909252608085015260ff90811660a085015260c08401929092521660e08201526101000190565b6000602082840312156121f257600080fd5b5051919050565b6020808252601f908201527f53656c6c6572206973206e6f74206f776e657220656e6f756768204e46547300604082015260600190565b60006020828403121561224257600080fd5b81518015158114610b7e57600080fd5b60208082526037908201527f4d61726b6574706c61636520646f206e6f742068617665207065726d6973736960408201527f6f6e20746f207472616e736665722074686973204e4654000000000000000000606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156122df576122df6122af565b500290565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6001600160a01b03958616815293909416602084015260408301919091526060820152901515608082015260a00190565b6000806040838503121561236057600080fd5b825161236b81611e9d565b6020939093015192949293505050565b60008261239857634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156123af576123af6122af565b500390565b600082198211156123c7576123c76122af565b500190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b634e487b7160e01b600052602160045260246000fdfea264697066735822122019329c80f4534dc2a2ee9a236ac2108279b77263f5f42e70abef95d5ff0235e964736f6c63430008090033000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000cb0d7e7e69c3c6121c8e8cf8292a786cc073b2e0000000000000000000000000000000000000000000000000000000000000000a
Deployed Bytecode
0x6080604052600436106100dd5760003560e01c80638da5cb5b1161007f578063ad5c464811610059578063ad5c46481461023b578063c0a515871461026f578063ec9807bb1461029f578063f2fde38b146102bf57600080fd5b80638da5cb5b146101c95780638eefba6a146101fb578063931742d31461021b57600080fd5b806340fff80c116100bb57806340fff80c1461014e578063715018a61461016e57806377d3550b146101835780638c9b3acf146101b657600080fd5b806301678d04146100e25780632ef8a162146100f757806336de97421461010a575b600080fd5b6100f56100f036600461200e565b6102df565b005b6100f561010536600461200e565b61068c565b34801561011657600080fd5b5061012a61012536600461205d565b6108df565b604080516001600160a01b0390931683526020830191909152015b60405180910390f35b34801561015a57600080fd5b506100f5610169366004612092565b610974565b34801561017a57600080fd5b506100f561099e565b34801561018f57600080fd5b506003546101a490600160a01b900460ff1681565b60405160ff9091168152602001610145565b6100f56101c43660046120af565b6109b2565b3480156101d557600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610145565b34801561020757600080fd5b506100f5610216366004612100565b610ad3565b34801561022757600080fd5b506003546101e3906001600160a01b031681565b34801561024757600080fd5b506101e37f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561027b57600080fd5b5061028f61028a366004612092565b610afb565b6040519015158152602001610145565b3480156102ab57600080fd5b506100f56102ba36600461211b565b610b85565b3480156102cb57600080fd5b506100f56102da366004612092565b610ced565b818160006103597fc8f4d2bc275da5ec1177ab31f368315d42f236b7d09cf0deecf8eaef842f7d9d846000015184600001518560200151876020015188604001518960600151600060405160200161033e989796959493929190612198565b60405160208183030381529060405280519060200120610d66565b9050600061036b828560800151610dba565b905083600001516001600160a01b0316816001600160a01b0316146103d75760405162461bcd60e51b815260206004820152601a60248201527f77726f6e672073656c6c206f66666572207369676e617475726500000000000060448201526064015b60405180910390fd5b8551606086015186516020880151604051627eeac760e11b8152899493926001600160a01b03169162fdd58e916104269186916004016001600160a01b03929092168252602082015260400190565b60206040518083038186803b15801561043e57600080fd5b505afa158015610452573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047691906121e0565b10156104945760405162461bcd60e51b81526004016103ce906121f9565b815160405163e985e9c560e01b81526001600160a01b0383811660048301523060248301529091169063e985e9c59060440160206040518083038186803b1580156104de57600080fd5b505afa1580156104f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105169190612230565b6105325760405162461bcd60e51b81526004016103ce90612252565b868060600151816040015161054791906122c5565b34101561058c5760405162461bcd60e51b8152602060048201526013602482015272496e73756666696369656e742066756e64732160681b60448201526064016103ce565b885160608901516020808b01518b51918d0151339392906105b086838584886109b2565b604051637921219560e11b81526001600160a01b0383169063f242432a906105e2908990899088908a906004016122e4565b600060405180830381600087803b1580156105fc57600080fd5b505af1158015610610573d6000803e3d6000fd5b50505050610622600180546001019055565b600061062d60015490565b905083836001600160a01b0316827e2fb2c9a8cec93e6d7e0ff2630fefa002899dc3cbf4474e8a9c90ca31f992e78a8a878b600060405161067295949392919061231c565b60405180910390a450505050505050505050505050505050565b8033606082015182516020840151604051627eeac760e11b81526001600160a01b038581166004830152602482019290925291169062fdd58e9060440160206040518083038186803b1580156106e157600080fd5b505afa1580156106f5573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071991906121e0565b10156107375760405162461bcd60e51b81526004016103ce906121f9565b815160405163e985e9c560e01b81526001600160a01b0383811660048301523060248301529091169063e985e9c59060440160206040518083038186803b15801561078157600080fd5b505afa158015610795573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b99190612230565b6107d55760405162461bcd60e51b81526004016103ce90612252565b6107e184846000610dde565b50835160608401516020808601518651918801513394939290610808868684868589611121565b604051637921219560e11b81526001600160a01b0383169063f242432a9061083a908990899088908a906004016122e4565b600060405180830381600087803b15801561085457600080fd5b505af1158015610868573d6000803e3d6000fd5b5050505061087a600180546001019055565b600061088560015490565b905083836001600160a01b0316827e2fb2c9a8cec93e6d7e0ff2630fefa002899dc3cbf4474e8a9c90ca31f992e78a8a878b60006040516108ca95949392919061231c565b60405180910390a45050505050505050505050565b60405163152a902d60e11b815260048101839052602481018290526000908190819081906001600160a01b03881690632a55205a90604401604080518083038186803b15801561092e57600080fd5b505afa158015610942573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610966919061234d565b909890975095505050505050565b61097c61139d565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6109a661139d565b6109b060006113f7565b565b60006109be82846122c5565b6003549091506000906064906109de90600160a01b900460ff16846122c5565b6109e8919061237b565b905060006109f6828461239d565b9050600080610a068989876108df565b90925090508015610a1e57610a1b818461239d565b92505b6040516001600160a01b038b169084156108fc029085906000818181858888f19350505050158015610a54573d6000803e3d6000fd5b506003546040516001600160a01b039091169085156108fc029086906000818181858888f19350505050158015610a8f573d6000803e3d6000fd5b506040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610ac6573d6000803e3d6000fd5b5050505050505050505050565b610adb61139d565b6003805460ff909216600160a01b0260ff60a01b19909216919091179055565b6040516301ffc9a760e01b815263152a902d60e11b600482015260009081906001600160a01b038416906301ffc9a79060240160206040518083038186803b158015610b4657600080fd5b505afa158015610b5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7e9190612230565b9392505050565b610b8d61139d565b82518160005a9050610ba187878787611447565b610bac878787611470565b60005a90506000610bbd828461239d565b9050610bcd615208613e806123b4565b610bd790826123b4565b90506000610be5483a6123b4565b610bef90836122c5565b905084811115610c4b5760405162461bcd60e51b815260206004820152602160248201527f476173206665652069732067726561746572207468616e20676173206c696d696044820152601d60fa1b60648201526084016103ce565b6040516323b872dd60e01b81527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316906323b872dd90610c9b908990339086906004016123cc565b602060405180830381600087803b158015610cb557600080fd5b505af1158015610cc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac69190612230565b610cf561139d565b6001600160a01b038116610d5a5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016103ce565b610d63816113f7565b50565b6000610db4610d736114ac565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b92915050565b6000806000610dc985856115d3565b91509150610dd681611619565b509392505050565b600083836000610e3f7fc8f4d2bc275da5ec1177ab31f368315d42f236b7d09cf0deecf8eaef842f7d9d846000015184600001518560200151876020015188604001518960600151600160405160200161033e989796959493929190612198565b90506000610e51828560800151610dba565b905083600001516001600160a01b0316816001600160a01b031614610eb85760405162461bcd60e51b815260206004820152601960248201527f77726f6e6720627579206f66666572207369676e61747572650000000000000060448201526064016103ce565b8751604088015160608901518880610ed083856122c5565b610eda91906123b4565b6040516370a0823160e01b81526001600160a01b0386811660048301527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906370a082319060240160206040518083038186803b158015610f3b57600080fd5b505afa158015610f4f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7391906121e0565b1015610fe75760405162461bcd60e51b815260206004820152603c60248201527f506c65617365207375626d6974207468652061736b696e67207072696365206960448201527f6e206f7264657220746f20636f6d706c6574652070757263686173650000000060648201526084016103ce565b80610ff283856122c5565b610ffc91906123b4565b604051636eb1769f60e11b81526001600160a01b0386811660048301523060248301527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2169063dd62ed3e9060440160206040518083038186803b15801561106357600080fd5b505afa158015611077573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109b91906121e0565b101561110f5760405162461bcd60e51b815260206004820152603a60248201527f506c6561736520616c6c6f77207468652061736b696e67205745544820696e2060448201527f6f7264657220746f20636f6d706c65746520707572636861736500000000000060648201526084016103ce565b5060019b9a5050505050505050505050565b600061112d82846122c5565b60035490915060009060649061114d90600160a01b900460ff16846122c5565b611157919061237b565b905060008060006111698989876108df565b909250905061117960028561237b565b611183908661239d565b925080156111a35761119660028261237b565b6111a0908461239d565b92505b6040516323b872dd60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906323b872dd906111f3908d908f9088906004016123cc565b602060405180830381600087803b15801561120d57600080fd5b505af1158015611221573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112459190612230565b506003546040516323b872dd60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28116926323b872dd9261129a928f92169089906004016123cc565b602060405180830381600087803b1580156112b457600080fd5b505af11580156112c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ec9190612230565b506040516323b872dd60e01b81526001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906323b872dd9061133d908d90869086906004016123cc565b602060405180830381600087803b15801561135757600080fd5b505af115801561136b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138f9190612230565b505050505050505050505050565b6000546001600160a01b031633146109b05760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103ce565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6114518483611767565b5061145d838383610dde565b506114698484846119ab565b5050505050565b825182516040830151606084015184516020860151611493868684848888611121565b6114a1868684848888611c96565b505050505050505050565b6000306001600160a01b037f0000000000000000000000005d93f9196a3db019cd2d019bcb5d8f65724fbb4d1614801561150557507f000000000000000000000000000000000000000000000000000000000000000146145b1561152f57507fe674a7acfabe0036725a810beda51f45099ef4952fbfe1666b99e82d327dd1d890565b50604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6020808301919091527f62da71a8de533c0eaaa8775d6fd0bb7c7c1dbe0762502966b86f3e38fdf14b57828401527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528351808403909101815260c0909201909252805191012090565b60008082516041141561160a5760208301516040840151606085015160001a6115fe87828585611d69565b94509450505050611612565b506000905060025b9250929050565b600081600481111561162d5761162d6123f0565b14156116365750565b600181600481111561164a5761164a6123f0565b14156116985760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016103ce565b60028160048111156116ac576116ac6123f0565b14156116fa5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016103ce565b600381600481111561170e5761170e6123f0565b1415610d635760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016103ce565b6000828260006117c87fc8f4d2bc275da5ec1177ab31f368315d42f236b7d09cf0deecf8eaef842f7d9d846000015184600001518560200151876020015188604001518960600151600060405160200161033e989796959493929190612198565b905060006117da828560800151610dba565b905083600001516001600160a01b0316816001600160a01b0316146118415760405162461bcd60e51b815260206004820152601a60248201527f77726f6e672073656c6c206f66666572207369676e617475726500000000000060448201526064016103ce565b8651606087015187516020890151604051627eeac760e11b81528a9493926001600160a01b03169162fdd58e916118909186916004016001600160a01b03929092168252602082015260400190565b60206040518083038186803b1580156118a857600080fd5b505afa1580156118bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e091906121e0565b10156118fe5760405162461bcd60e51b81526004016103ce906121f9565b815160405163e985e9c560e01b81526001600160a01b0383811660048301523060248301529091169063e985e9c59060440160206040518083038186803b15801561194857600080fd5b505afa15801561195c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119809190612230565b61199c5760405162461bcd60e51b81526004016103ce90612252565b50600198975050505050505050565b600081604001518460200151846020015186604001518660400151600060ff168260ff1614806119de575060ff82166001145b611a2a5760405162461bcd60e51b815260206004820152601960248201527f53656c6c2070726963652074797065206e6f742076616c69640000000000000060448201526064016103ce565b60ff81161580611a3d575060ff81166001145b611a895760405162461bcd60e51b815260206004820152601860248201527f4275792070726963652074797065206e6f742076616c6964000000000000000060448201526064016103ce565b60ff8216611aec57838514611aec5760405162461bcd60e51b815260206004820152602360248201527f4d61746368207072696365206e6f7420657175616c20746f2073656c6c20707260448201526269636560e81b60648201526084016103ce565b60ff8116611b4e57828514611b4e5760405162461bcd60e51b815260206004820152602260248201527f4d61746368207072696365206e6f7420657175616c20746f2062757920707269604482015261636560f01b60648201526084016103ce565b60ff821660011415611bc25783851015611bc25760405162461bcd60e51b815260206004820152602f60248201527f4d61746368207072696365206d7573742062652067726561746572207468616e60448201526e206d696e2073656c6c20707269636560881b60648201526084016103ce565b60ff811660011415611c325784831015611c325760405162461bcd60e51b815260206004820152602b60248201527f4d61746368207072696365206d757374206265206c657373207468616e206d6160448201526a782062757920707269636560a81b60648201526084016103ce565b886060015188606001518860600151828111158015611c515750818111155b61110f5760405162461bcd60e51b815260206004820152601660248201527513585d18da08185b5bdd5b9d081b9bdd081d985b1a5960521b60448201526064016103ce565b604051637921219560e11b81526001600160a01b0385169063f242432a90611cc89089908990889087906004016122e4565b600060405180830381600087803b158015611ce257600080fd5b505af1158015611cf6573d6000803e3d6000fd5b50505050611d08600180546001019055565b6000611d1360015490565b905083856001600160a01b0316827e2fb2c9a8cec93e6d7e0ff2630fefa002899dc3cbf4474e8a9c90ca31f992e78a8a88886000604051611d5895949392919061231c565b60405180910390a450505050505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0831115611da05750600090506003611e24565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015611df4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116611e1d57600060019250925050611e24565b9150600090505b94509492505050565b634e487b7160e01b600052604160045260246000fd5b60405160a0810167ffffffffffffffff81118282101715611e6657611e66611e2d565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715611e9557611e95611e2d565b604052919050565b6001600160a01b0381168114610d6357600080fd5b803560ff81168114611ec357600080fd5b919050565b600060a08284031215611eda57600080fd5b611ee2611e43565b90508135611eef81611e9d565b815260208281013581830152611f0760408401611eb2565b604083015260608301356060830152608083013567ffffffffffffffff80821115611f3157600080fd5b818501915085601f830112611f4557600080fd5b813581811115611f5757611f57611e2d565b611f69601f8201601f19168501611e6c565b91508082528684828501011115611f7f57600080fd5b808484018584013760008482840101525080608085015250505092915050565b600060808284031215611fb157600080fd5b6040516080810181811067ffffffffffffffff82111715611fd457611fd4611e2d565b6040529050808235611fe581611e9d565b808252506020830135602082015260408301356040820152606083013560608201525092915050565b60008060a0838503121561202157600080fd5b823567ffffffffffffffff81111561203857600080fd5b61204485828601611ec8565b9250506120548460208501611f9f565b90509250929050565b60008060006060848603121561207257600080fd5b833561207d81611e9d565b95602085013595506040909401359392505050565b6000602082840312156120a457600080fd5b8135610b7e81611e9d565b600080600080600060a086880312156120c757600080fd5b85356120d281611e9d565b945060208601356120e281611e9d565b94979496505050506040830135926060810135926080909101359150565b60006020828403121561211257600080fd5b610b7e82611eb2565b60008060008060e0858703121561213157600080fd5b843567ffffffffffffffff8082111561214957600080fd5b61215588838901611ec8565b9550602087013591508082111561216b57600080fd5b5061217887828801611ec8565b9350506121888660408701611f9f565b9396929550929360c00135925050565b9788526001600160a01b0396871660208901529490951660408701526060860192909252608085015260ff90811660a085015260c08401929092521660e08201526101000190565b6000602082840312156121f257600080fd5b5051919050565b6020808252601f908201527f53656c6c6572206973206e6f74206f776e657220656e6f756768204e46547300604082015260600190565b60006020828403121561224257600080fd5b81518015158114610b7e57600080fd5b60208082526037908201527f4d61726b6574706c61636520646f206e6f742068617665207065726d6973736960408201527f6f6e20746f207472616e736665722074686973204e4654000000000000000000606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156122df576122df6122af565b500290565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b6001600160a01b03958616815293909416602084015260408301919091526060820152901515608082015260a00190565b6000806040838503121561236057600080fd5b825161236b81611e9d565b6020939093015192949293505050565b60008261239857634e487b7160e01b600052601260045260246000fd5b500490565b6000828210156123af576123af6122af565b500390565b600082198211156123c7576123c76122af565b500190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b634e487b7160e01b600052602160045260246000fdfea264697066735822122019329c80f4534dc2a2ee9a236ac2108279b77263f5f42e70abef95d5ff0235e964736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000cb0d7e7e69c3c6121c8e8cf8292a786cc073b2e0000000000000000000000000000000000000000000000000000000000000000a
-----Decoded View---------------
Arg [0] : _WETH (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [1] : _commissionAddress (address): 0xCb0D7e7E69C3c6121c8E8CF8292a786CC073b2E0
Arg [2] : _commissionPercent (uint8): 10
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [1] : 000000000000000000000000cb0d7e7e69c3c6121c8e8cf8292a786cc073b2e0
Arg [2] : 000000000000000000000000000000000000000000000000000000000000000a
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 33 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
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.