// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/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 be 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 v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 tokenId
) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes calldata data
) external;
}
//SPDX-License-Identifier: MIT
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
/**
* @dev: @brougkr
*/
pragma solidity 0.8.12;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC1155} from "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
contract Marketplace is Ownable, ReentrancyGuard
{
/***************************/
/********** STRUCT *********/
/***************************/
struct Sale
{
string Name;
uint PriceBrightList;
uint PricePublic;
uint StartingIndex;
uint EndingIndex;
uint PurchaseableAmountBrightList;
uint PurchaseableAmountPublic;
uint ERC_TYPE;
address ContractAddress;
address Operator;
bytes32 Root;
bool ActivePublic;
bool ActiveBrightList;
bool AllowMultiplePurchases;
}
/***************************/
/********* MAPPINGS ********/
/***************************/
mapping(uint => Sale) private Sales;
mapping(uint => uint) public SaleProceeds;
mapping(address => bytes32) public BRTOperators;
mapping(uint => mapping(address => bool)) public MarketplacePurchased;
mapping(uint => mapping(address => uint)) public PurchasedAmountBrightList;
mapping(uint => mapping(address => uint)) public PurchasedAmountPublic;
/***************************/
/********** EVENTS *********/
/***************************/
/**
* @dev Emitted When A BrightList Purchase Occurs
*/
event MarketplacePurchaseEventBrightList(
address indexed recipientAddress,
uint indexed SaleIndex,
uint amount
);
/**
* @dev Emitted When A Public Purchase Occurs
*/
event MarketplacePurchaseEvent(
address indexed recipientAddress,
uint indexed SaleIndex,
uint amount
);
/**
* @dev Emitted When A Sale Has Started
*/
event SaleStarted(
string Name,
address ContractAddress,
bytes32 RootHash,
address Operator,
bool ActivePublic,
bool ActiveBrightList,
bool AllowMultiplePurchases
);
/**
* @dev Emitted When A Batch Of Sales Have Been Initialized
*/
event SalesStarted(uint StartingSaleIndex, uint EndingSaleIndex);
/**
* @dev Emitted When Various State Variables Are Modified
*/
event SaleEnded(uint SaleIndex);
event SaleChangedName(uint indexed SaleIndex, string OldName, string NewName);
event SaleChangedStartingIndex(uint indexed SaleIndex, uint OldStartingIndex, uint NewStartingIndex);
event SaleChangedEndingIndex(uint indexed SaleIndex, uint OldEndingIndex, uint NewEndingIndex);
event SaleChangedAllocationPublic(uint indexed SaleIndex, uint OldAllocation, uint NewAllocation);
event SaleChangedAllocationBrightList(uint indexed SaleIndex, uint OldAllocation, uint NewAllocation);
event SaleChangedPriceBrightList(uint indexed SaleIndex, uint OldPrice, uint NewPrice);
event SaleChangedPricePublic(uint indexed SaleIndex, uint OldPrice, uint NewPrice);
event SaleChangedERC_TYPE(uint indexed SaleIndex, uint OLD_ERC_TYPE, uint NEW_ERC_TYPE);
event SaleChangedContract(uint indexed SaleIndex, address OldContract, address NewContract);
event SaleChangedRoot(uint indexed SaleIndex, bytes32 OldRoot, bytes32 NewRoot);
event SaleChangedOperator(uint indexed SaleIndex, address OldOperator, address NewOperator);
event SaleChangedActiveState(uint indexed SaleIndex, bool OldState, bool NewState);
event SaleChangedActiveStateBrightList(uint indexed SaleIndex, bool OldState, bool NewState);
event SaleChangedActiveStatesPublic(uint[] SaleIndexes, bool[] States);
event SaleChangedActiveStatesBrightList(uint[] SaleIndexes, bool[] States);
/**
* @dev Emitted When BRT Multisig Adds Or Removes An Operator
*/
event OperatorAdded(address Operator);
event OperatorRemoved(address Operator);
/**
* @dev Amount Of Unique Marketplace Sales
*/
uint public UniqueSaleIndex;
/**
* @dev BRT Operator Roles
*/
bytes32 private immutable _OPERATOR = keccak256("OPERATOR");
bytes32 private immutable _DEACTIVATED = 0x0;
/**
* @dev Constructor
*/
constructor()
{
BRTOperators[0x5778B0B140Fa7a62B96c193cC8621e6E96c088A5] = _OPERATOR; //brougkr
BRTOperators[0x18782E9d3fB2E8D17CBF7a1F72c5f4e09E263734] = _OPERATOR; //jesse.brightmoments.eth
BRTOperators[0x18B7511938FBe2EE08ADf3d4A24edB00A5C9B783] = _OPERATOR; //phil.brightmoments.eth
BRTOperators[0xbf001FF749b7E793bbb1A612d09124470b9179A7] = _OPERATOR; //future
}
/***************************/
/***** PUBLIC FUNCTIONS ****/
/***************************/
/**
* @dev Marketplace Purchase Public Sale
*/
function MarketplacePurchase(uint SaleIndex, uint Amount) public payable nonReentrant
{
require(Sales[SaleIndex].ActivePublic, "Requested Sale Is Not Available For Public Purchases");
require(Sales[SaleIndex].StartingIndex <= Sales[SaleIndex].EndingIndex, "Sold Out");
require(
PurchasedAmountPublic[SaleIndex][msg.sender] + Amount <= Sales[SaleIndex].PurchaseableAmountPublic,
"User Has Used Up All Of Public Allocation For This Sale Index"
);
if(!Sales[SaleIndex].AllowMultiplePurchases) { require(!MarketplacePurchased[SaleIndex][msg.sender], "User Has Already Purchased This Sale Index"); }
require(msg.value == Sales[SaleIndex].PricePublic * Amount && Amount > 0, "Incorrect Ether Amount Or Token Amount Sent For Purchase");
if(!MarketplacePurchased[SaleIndex][msg.sender]) { MarketplacePurchased[SaleIndex][msg.sender] = true; }
PurchasedAmountPublic[SaleIndex][msg.sender] += Amount;
for(uint i; i < Amount; i++)
{
if(Sales[SaleIndex].ERC_TYPE == 721)
{
IERC721(Sales[SaleIndex].ContractAddress).transferFrom(
Sales[SaleIndex].Operator,
msg.sender,
Sales[SaleIndex].StartingIndex
);
}
else if(Sales[SaleIndex].ERC_TYPE == 1155)
{
IERC1155(Sales[SaleIndex].ContractAddress).safeTransferFrom(
Sales[SaleIndex].Operator,
msg.sender,
Sales[SaleIndex].StartingIndex,
1,
"BRT"
);
}
Sales[SaleIndex].StartingIndex++;
}
SaleProceeds[SaleIndex] += msg.value;
emit MarketplacePurchaseEvent(msg.sender, SaleIndex, Amount);
}
/**
* @dev Marketplace Purchase BrightList Sale
*/
function MarketplacePurchaseBrightList(uint SaleIndex, uint Amount, bytes32[] calldata Proof) public payable nonReentrant
{
require(Sales[SaleIndex].ActiveBrightList, "Requested Sale Is Not Available For BrightList Purchases");
require(Sales[SaleIndex].StartingIndex <= Sales[SaleIndex].EndingIndex, "Sold Out");
require(msg.value == Sales[SaleIndex].PriceBrightList * Amount && Amount > 0, "Incorrect Ether Amount Or Token Amount Sent For Purchase");
require(viewBrightListAllocation(msg.sender, SaleIndex, Proof), "User Is Not On BrightList");
require(
PurchasedAmountBrightList[SaleIndex][msg.sender] + Amount <= Sales[SaleIndex].PurchaseableAmountBrightList,
"User Has Used Up All BrightList Allocation For This Sale Index"
);
if(!Sales[SaleIndex].AllowMultiplePurchases) { require(!MarketplacePurchased[SaleIndex][msg.sender], "User Has Already Purchased This Sale Index"); }
if(!MarketplacePurchased[SaleIndex][msg.sender]) { MarketplacePurchased[SaleIndex][msg.sender] = true; }
PurchasedAmountBrightList[SaleIndex][msg.sender] += Amount;
for(uint i; i < Amount; i++)
{
if(Sales[SaleIndex].ERC_TYPE == 721)
{
IERC721(Sales[SaleIndex].ContractAddress).transferFrom(
Sales[SaleIndex].Operator,
msg.sender,
Sales[SaleIndex].StartingIndex
);
}
else if(Sales[SaleIndex].ERC_TYPE == 1155)
{
IERC1155(Sales[SaleIndex].ContractAddress).safeTransferFrom(
Sales[SaleIndex].Operator,
msg.sender,
Sales[SaleIndex].StartingIndex,
1,
"BRT"
);
}
Sales[SaleIndex].StartingIndex++;
}
SaleProceeds[SaleIndex] += msg.value;
emit MarketplacePurchaseEventBrightList(msg.sender, SaleIndex, Amount);
}
/***************************/
/**** _OPERATOR COMMANDS ****/
/***************************/
/**
* @dev Sets Up A New Sale
* note: `Price` Is Input In WEI Due To Ethereum EVM. For Example, 1 ETH = 1000000000000000000 WEI
* note: `ERC_TYPE` Is (`721` for ERC721) || (`1155` for ERC1155)
* note: `ContractAddress` Is The NFT Contract Address
* note: `RootHash` Is Merkle Root Hash
* note: `Operator` Is The Wallet Providing The NFTs For Sale. They Will Have To setApprovalForAll() On This Contract
* note: `Public` & `AllowMultiplePurchases` Are Either `true` or `false`
*/
function _StartSale(Sale memory NewSaleInstance) external onlyBRTOperator
{
//Checks Passed Variables
require(
NewSaleInstance.ERC_TYPE == 721 || NewSaleInstance.ERC_TYPE == 1155,
"Incorrect ERC Type. (721 for ERC721) or (1155 for ERC1155)"
);
//Auto-Increments The Unique Sale Index
UniqueSaleIndex++;
//Assigns State Variables To The New Sale Instance
Sales[UniqueSaleIndex].Name = NewSaleInstance.Name;
Sales[UniqueSaleIndex].PriceBrightList = NewSaleInstance.PriceBrightList;
Sales[UniqueSaleIndex].PricePublic = NewSaleInstance.PricePublic;
Sales[UniqueSaleIndex].StartingIndex = NewSaleInstance.StartingIndex;
Sales[UniqueSaleIndex].EndingIndex = NewSaleInstance.EndingIndex;
Sales[UniqueSaleIndex].PurchaseableAmountBrightList = NewSaleInstance.PurchaseableAmountBrightList;
Sales[UniqueSaleIndex].PurchaseableAmountPublic = NewSaleInstance.PurchaseableAmountPublic;
Sales[UniqueSaleIndex].ERC_TYPE = NewSaleInstance.ERC_TYPE;
Sales[UniqueSaleIndex].ContractAddress = NewSaleInstance.ContractAddress;
Sales[UniqueSaleIndex].Operator = NewSaleInstance.Operator;
Sales[UniqueSaleIndex].Root = NewSaleInstance.Root;
Sales[UniqueSaleIndex].ActivePublic = NewSaleInstance.ActivePublic;
Sales[UniqueSaleIndex].ActiveBrightList = NewSaleInstance.ActiveBrightList;
Sales[UniqueSaleIndex].AllowMultiplePurchases = NewSaleInstance.AllowMultiplePurchases;
//Emits Base Data Of The New Sale Instance
emit SaleStarted(
Sales[UniqueSaleIndex].Name,
Sales[UniqueSaleIndex].ContractAddress,
Sales[UniqueSaleIndex].Root,
Sales[UniqueSaleIndex].Operator,
Sales[UniqueSaleIndex].ActivePublic,
Sales[UniqueSaleIndex].ActiveBrightList,
Sales[UniqueSaleIndex].AllowMultiplePurchases
);
}
/**
* @dev Batch Startes Multiple Sales
*/
function _StartSales(Sale[] memory NewSaleInstance) external onlyBRTOperator
{
uint StartingSaleIndex = UniqueSaleIndex;
for(uint i; i < NewSaleInstance.length; i++)
{
//Checks Passed Variables
require(
NewSaleInstance[i].ERC_TYPE == 721 || NewSaleInstance[i].ERC_TYPE == 1155,
"Please Enter Valid ERC-TYPE, (721 for ERC-721), (1155 for ERC-1155)"
);
//Auto Increments Index
UniqueSaleIndex++;
//Assigns State Variables To The New Sale Instance
Sales[UniqueSaleIndex].Name = NewSaleInstance[i].Name;
Sales[UniqueSaleIndex].PriceBrightList = NewSaleInstance[i].PriceBrightList;
Sales[UniqueSaleIndex].PricePublic = NewSaleInstance[i].PricePublic;
Sales[UniqueSaleIndex].StartingIndex = NewSaleInstance[i].StartingIndex;
Sales[UniqueSaleIndex].EndingIndex = NewSaleInstance[i].EndingIndex;
Sales[UniqueSaleIndex].PurchaseableAmountBrightList = NewSaleInstance[i].PurchaseableAmountBrightList;
Sales[UniqueSaleIndex].PurchaseableAmountPublic = NewSaleInstance[i].PurchaseableAmountPublic;
Sales[UniqueSaleIndex].ERC_TYPE = NewSaleInstance[i].ERC_TYPE;
Sales[UniqueSaleIndex].ContractAddress = NewSaleInstance[i].ContractAddress;
Sales[UniqueSaleIndex].Operator = NewSaleInstance[i].Operator;
Sales[UniqueSaleIndex].Root = NewSaleInstance[i].Root;
Sales[UniqueSaleIndex].ActivePublic = NewSaleInstance[i].ActivePublic;
Sales[UniqueSaleIndex].ActiveBrightList = NewSaleInstance[i].ActiveBrightList;
Sales[UniqueSaleIndex].AllowMultiplePurchases = NewSaleInstance[i].AllowMultiplePurchases;
}
emit SalesStarted(StartingSaleIndex, UniqueSaleIndex);
}
/**
* @dev Changes BrightList Sale Name `Name` At Index `SaleIndex`
* note: This Is The Name Of The Sale
*/
function _ChangeSaleName(uint SaleIndex, string memory Name) external onlyBRTOperator
{
string memory OldName = Sales[SaleIndex].Name;
Sales[SaleIndex].Name = Name;
emit SaleChangedName(SaleIndex, OldName, Name);
}
/**
* @dev Changes BrightList StartingIndex `Index` At Index `SaleIndex`
* note: This Is The Starting Token ID
*/
function _ChangeSaleStartingIndex(uint SaleIndex, uint Index) external onlyBRTOperator
{
uint OldStartingIndex = Sales[SaleIndex].StartingIndex;
Sales[SaleIndex].StartingIndex = Index;
emit SaleChangedStartingIndex(SaleIndex, OldStartingIndex, Index);
}
/**
* @dev Changes BrightList EndingIndex `Index` At Index `SaleIndex`
* note: This Is The Ending Token ID
*/
function _ChangeSaleEndingIndex(uint SaleIndex, uint Index) external onlyBRTOperator
{
uint OldEndingIndex = Sales[SaleIndex].EndingIndex;
Sales[SaleIndex].EndingIndex = Index;
emit SaleChangedEndingIndex(SaleIndex, OldEndingIndex, Index);
}
/**
* @dev Changes Brightlist Public Purchasable Amount `Amount` At Index `SaleIndex`
* note: This Is The Public Allocation
*/
function _ChangeSaleAllocationPublic(uint SaleIndex, uint Amount) external onlyBRTOperator
{
uint OldAllocation = Sales[SaleIndex].PurchaseableAmountBrightList;
Sales[SaleIndex].PurchaseableAmountPublic = Amount;
emit SaleChangedAllocationPublic(SaleIndex, OldAllocation, Amount);
}
/**
* @dev Changes Brightlist Purchasable Amount `Amount` At Index `SaleIndex`
* note: This Is The BrightList Allocation
*/
function _ChangeSaleAllocationBrightList(uint SaleIndex, uint Amount) external onlyBRTOperator
{
uint OldAllocation = Sales[SaleIndex].PurchaseableAmountBrightList;
Sales[SaleIndex].PurchaseableAmountBrightList = Amount;
emit SaleChangedAllocationBrightList(SaleIndex, OldAllocation, Amount);
}
/**
* @dev Changes Sale Price Public Amount `Price` At Index `SaleIndex`
* note: This Is Input In WEI Not In Ether. 1 ETH = 1000000000000000000 WEI
*/
function _ChangeSalePricePublic(uint SaleIndex, uint Price) external onlyBRTOperator
{
uint OldPrice = Sales[SaleIndex].PriceBrightList;
Sales[SaleIndex].PricePublic = Price;
emit SaleChangedPricePublic(SaleIndex, OldPrice, Price);
}
/**
* @dev Changes Sale Price BrightList Amount `Price` At Index `SaleIndex`
* note: This Is Input In WEI Not In Ether. 1 ETH = 1000000000000000000 WEI
*/
function _ChangeSalePriceBrightList(uint SaleIndex, uint Price) external onlyBRTOperator
{
uint OldPrice = Sales[SaleIndex].PriceBrightList;
Sales[SaleIndex].PriceBrightList = Price;
emit SaleChangedPriceBrightList(SaleIndex, OldPrice, Price);
}
/**
* @dev Changes BrightList ERC Type `ERC_TYPE` At Index `SaleIndex`
* note: Possible Inputs Are:
* `721` - ERC721
* `1155` - ERC1155
*/
function _ChangeSaleERC_TYPE(uint SaleIndex, uint ERC_TYPE) external onlyBRTOperator
{
require(ERC_TYPE == 721 || ERC_TYPE == 1155, "Incorrect ERC_TYPE");
uint Old_ERC_TYPE = Sales[SaleIndex].ERC_TYPE;
Sales[SaleIndex].ERC_TYPE = ERC_TYPE;
emit SaleChangedERC_TYPE(SaleIndex, Old_ERC_TYPE, ERC_TYPE);
}
/**
* @dev Changes BrightList Contract Address `Contract` At Index `SaleIndex`
* note: This Is The NFT Address That Is Being Claimed
*/
function _ChangeSaleContract(uint SaleIndex, address Contract) external onlyBRTOperator
{
address OldContract = Sales[SaleIndex].ContractAddress;
Sales[SaleIndex].ContractAddress = Contract;
emit SaleChangedContract(SaleIndex, OldContract, Contract);
}
/**
* @dev Changes BrightList Operator `operator` At Index `SaleIndex`
* note: This Is The Wallet / Address / EOA That The NFTs Are Pulling From
*/
function _ChangeSaleOperator(uint SaleIndex, address Operator) external onlyBRTOperator
{
address OldOperator = Sales[SaleIndex].Operator;
Sales[SaleIndex].Operator = Operator;
emit SaleChangedOperator(SaleIndex, OldOperator, Operator);
}
/**
* @dev Changes BrightList Root `RootHash` At Index `SaleIndex`
* note: This Is The Merkle Root
*/
function _ChangeSaleRoot(uint SaleIndex, bytes32 RootHash) external onlyBRTOperator
{
bytes32 OldRoot = Sales[SaleIndex].Root;
Sales[SaleIndex].Root = RootHash;
emit SaleChangedRoot(SaleIndex, OldRoot, RootHash);
}
/**
* @dev Changes Public Sale State `State` At Index `SaleIndex`
* note: Possible Inputs are `true` or `false`
*/
function _ChangeSaleActiveStatePublic(uint SaleIndex, bool State) external onlyBRTOperator
{
bool OldState = Sales[SaleIndex].ActivePublic;
Sales[SaleIndex].ActivePublic = State;
emit SaleChangedActiveState(SaleIndex, OldState, State);
}
/**
* @dev Changes BrightList Sale State `State` At Index `SaleIndex`
* note: Possible Inputs are `true` or `false`
*/
function _ChangeSaleActiveStateBrightList(uint SaleIndex, bool State) external onlyBRTOperator
{
bool OldState = Sales[SaleIndex].ActiveBrightList;
Sales[SaleIndex].ActiveBrightList = State;
emit SaleChangedActiveStateBrightList(SaleIndex, OldState, State);
}
/**
* @dev Changes BrightList Sale States `States` At Index `SaleIndex`
* note: Possible Inputs are array of `true` or `false`
*/
function _ChangeSaleActiveStatesBrightList(uint[] calldata SaleIndexes, bool[] calldata States) external onlyBRTOperator
{
for(uint i; i < SaleIndexes.length; i++)
{
Sales[i].ActiveBrightList = States[i];
}
emit SaleChangedActiveStatesBrightList(SaleIndexes, States);
}
/**
* @dev Changes Public Sale State `State` At Index `SaleIndex`
* note: Possible Inputs are array of `true` or `false`
*/
function _ChangeSaleActiveStatesPublic(uint[] calldata SaleIndexes, bool[] calldata States) external onlyBRTOperator
{
for(uint i; i < SaleIndexes.length; i++)
{
Sales[i].ActiveBrightList = States[i];
}
emit SaleChangedActiveStatesPublic(SaleIndexes, States);
}
/**
* @dev Ends Sale At Index `SaleIndex`
*/
function _EndSale(uint SaleIndex) external onlyBRTOperator
{
Sales[SaleIndex].ActivePublic = false;
emit SaleEnded(SaleIndex);
}
/***************************/
/****** ADMIN COMMANDS *****/
/***************************/
/**
* @dev Adds Bright Moments Operator
* note: OnlyOwner
*/
function __OperatorAdd(address Operator) external onlyOwner
{
BRTOperators[Operator] = _OPERATOR;
emit OperatorAdded(Operator);
}
/**
* @dev Removes Bright Moments Operator
* note: OnlyOwner
*/
function __OperatorRemove(address Operator) external onlyOwner
{
BRTOperators[Operator] = _DEACTIVATED;
emit OperatorRemoved(Operator);
}
/**
* @dev Withdraws All Ether From Contract To Owner
* note: OnlyOwner
*/
function __Withdraw() external onlyOwner
{
uint balance = address(this).balance;
require(balance > 0, "Insufficient Balance");
payable(owner()).transfer(balance);
}
/**
* @dev Withdraws Ether From Contract To Address
* note: OnlyOwner
*/
function __WithdrawToAddress(address payable Recipient) external onlyOwner
{
uint balance = address(this).balance;
require(balance > 0, "Insufficient Ether To Withdraw");
(bool Success, ) = Recipient.call{value: balance}("");
require(Success, "Unable to Withdraw, Recipient May Have Reverted");
}
/**
* @dev Withdraws Ether From Contract To Address With An Amount
* note: OnlyOwner
* note: `Amount` is Denoted In WEI ()
*/
function __WithdrawAmountToAddress(address payable Recipient, uint Amount) external onlyOwner
{
require(Amount > 0 && Amount <= address(this).balance, "Invalid Amount");
(bool Success, ) = Recipient.call{value: Amount}("");
require(Success, "Unable to Withdraw, Recipient May Have Reverted");
}
/**
* @dev Withdraws Ether From Sale Instance To Owner
* note: OnlyOwner
*/
function __WithdrawSaleProceeds(uint SaleIndex) external onlyOwner
{
uint Amount = SaleProceeds[SaleIndex];
require(Amount > 0 && Amount <= address(this).balance, "Insufficient Balance");
SaleProceeds[SaleIndex] = 0;
(bool Success, ) = owner().call{value: Amount}("");
require(Success, "Unable to Withdraw, Recipient May Have Reverted");
}
/**
* @dev Withdraws Ether From Sale Instance To Address
* note: OnlyOwner
*/
function __WithdrawSaleProceedsToAddress(address payable Recipient, uint SaleIndex) external onlyOwner
{
uint Amount = SaleProceeds[SaleIndex];
require(Amount > 0 && Amount <= address(this).balance, "Insufficient Balance");
SaleProceeds[SaleIndex] = 0;
(bool Success, ) = Recipient.call{value: Amount}("");
require(Success, "Unable to Withdraw, Recipient May Have Reverted");
}
/**
* @dev Withdraws ERC20 From Contract To Address
* note: OnlyOwner
*/
function __WithdrawERC20ToAddress(address Recipient, address ContractAddress) external onlyOwner
{
IERC20 ERC20 = IERC20(ContractAddress);
ERC20.transferFrom(address(this), Recipient, ERC20.balanceOf(address(this)));
}
/***************************/
/******* PUBLIC VIEW *******/
/***************************/
/**
* @dev Checks BrightList Allocation
*/
function viewBrightListAllocation(address Recipient, uint SaleIndex, bytes32[] memory Proof) public view returns(bool)
{
bytes32 Leaf = keccak256(abi.encodePacked(Recipient));
return MerkleProof.verify(Proof, Sales[SaleIndex].Root, Leaf);
}
/**
* @dev Returns State Variables Of `SaleIndex`
* note: `0. Name`
* note: `1. Price BrightList`
* note: `2. Price Public`
* note: `3. StartingIndex`
* note: `4. EndingIndex`
* note: `5. Purchaseable Amount BrightList`
* note: `6. Purchaseable Amount Public`
* note: `7. ERC_TYPE (721 for ERC721) || (1155 for ERC1155)`
* note: `8. ContractAddress` Of NFT
* note: `9. Operator`
* note: `10. Merkle Root`
* note: `11. Is Sale Public Active`
* note: `12. Is Sale BrightList Active`
* note: `13. Allow Multiple Purchases`
*/
function viewSaleState(uint SaleIndex) public view returns(Sale memory) { return Sales[SaleIndex]; }
/**
* @dev Returns Multiple Sale Instances Of `SaleIndex`
* note: `0. Name`
* note: `1. Price BrightList`
* note: `2. Price Public`
* note: `3. StartingIndex`
* note: `4. EndingIndex`
* note: `5. Purchaseable Amount BrightList`
* note: `6. Purchaseable Amount Public`
* note: `7. ERC_TYPE (721 for ERC721) || (1155 for ERC1155)`
* note: `8. ContractAddress` Of NFT
* note: `9. Operator`
* note: `10. Merkle Root`
* note: `11. Is Sale Public Active`
* note: `12. Is Sale BrightList Active`
* note: `13. Allow Multiple Purchases`
*/
function viewSaleStates(uint[] calldata SaleIndexes) public view returns(Sale[] memory)
{
Sale[] memory SaleStates = new Sale[](SaleIndexes.length);
for (uint i; i < SaleIndexes.length; i++)
{
Sale storage saleInstance = Sales[SaleIndexes[i]];
SaleStates[i] = saleInstance;
}
return SaleStates;
}
/***************************/
/******** MODIFIER *********/
/***************************/
/**
* @dev Restricts Certain Functions To Bright Moments Operators Only
*/
modifier onlyBRTOperator
{
require(BRTOperators[msg.sender] == _OPERATOR, "User Is Not A Valid BRT Operator");
_;
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)
pragma solidity ^0.8.0;
/**
* @dev These functions deal with verification of Merkle Trees proofs.
*
* The proofs can be generated using the JavaScript library
* https://github.com/miguelmota/merkletreejs[merkletreejs].
* Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
*
* See `test/utils/cryptography/MerkleProof.test.js` for some examples.
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(
bytes32[] memory proof,
bytes32 root,
bytes32 leaf
) internal pure returns (bool) {
return processProof(proof, leaf) == root;
}
/**
* @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
* from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
* hash matches the root of the tree. When processing the proof, the pairs
* of leafs & pre-images are assumed to be sorted.
*
* _Available since v4.4._
*/
function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = _efficientHash(computedHash, proofElement);
} else {
// Hash(current element of the proof + current computed hash)
computedHash = _efficientHash(proofElement, computedHash);
}
}
return computedHash;
}
function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
assembly {
mstore(0x00, a)
mstore(0x20, b)
value := keccak256(0x00, 0x40)
}
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
{
"compilationTarget": {
"contracts/Marketplace.sol": "Marketplace"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 1000
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipientAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MarketplacePurchaseEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"recipientAddress","type":"address"},{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"MarketplacePurchaseEventBrightList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"Operator","type":"address"}],"name":"OperatorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"Operator","type":"address"}],"name":"OperatorRemoved","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"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"bool","name":"OldState","type":"bool"},{"indexed":false,"internalType":"bool","name":"NewState","type":"bool"}],"name":"SaleChangedActiveState","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"bool","name":"OldState","type":"bool"},{"indexed":false,"internalType":"bool","name":"NewState","type":"bool"}],"name":"SaleChangedActiveStateBrightList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"SaleIndexes","type":"uint256[]"},{"indexed":false,"internalType":"bool[]","name":"States","type":"bool[]"}],"name":"SaleChangedActiveStatesBrightList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"SaleIndexes","type":"uint256[]"},{"indexed":false,"internalType":"bool[]","name":"States","type":"bool[]"}],"name":"SaleChangedActiveStatesPublic","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"OldAllocation","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"NewAllocation","type":"uint256"}],"name":"SaleChangedAllocationBrightList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"OldAllocation","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"NewAllocation","type":"uint256"}],"name":"SaleChangedAllocationPublic","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"OldContract","type":"address"},{"indexed":false,"internalType":"address","name":"NewContract","type":"address"}],"name":"SaleChangedContract","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"OLD_ERC_TYPE","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"NEW_ERC_TYPE","type":"uint256"}],"name":"SaleChangedERC_TYPE","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"OldEndingIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"NewEndingIndex","type":"uint256"}],"name":"SaleChangedEndingIndex","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"string","name":"OldName","type":"string"},{"indexed":false,"internalType":"string","name":"NewName","type":"string"}],"name":"SaleChangedName","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"address","name":"OldOperator","type":"address"},{"indexed":false,"internalType":"address","name":"NewOperator","type":"address"}],"name":"SaleChangedOperator","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"OldPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"NewPrice","type":"uint256"}],"name":"SaleChangedPriceBrightList","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"OldPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"NewPrice","type":"uint256"}],"name":"SaleChangedPricePublic","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"OldRoot","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"NewRoot","type":"bytes32"}],"name":"SaleChangedRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"OldStartingIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"NewStartingIndex","type":"uint256"}],"name":"SaleChangedStartingIndex","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"SaleIndex","type":"uint256"}],"name":"SaleEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"Name","type":"string"},{"indexed":false,"internalType":"address","name":"ContractAddress","type":"address"},{"indexed":false,"internalType":"bytes32","name":"RootHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"Operator","type":"address"},{"indexed":false,"internalType":"bool","name":"ActivePublic","type":"bool"},{"indexed":false,"internalType":"bool","name":"ActiveBrightList","type":"bool"},{"indexed":false,"internalType":"bool","name":"AllowMultiplePurchases","type":"bool"}],"name":"SaleStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"StartingSaleIndex","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"EndingSaleIndex","type":"uint256"}],"name":"SalesStarted","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"BRTOperators","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Amount","type":"uint256"}],"name":"MarketplacePurchase","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Amount","type":"uint256"},{"internalType":"bytes32[]","name":"Proof","type":"bytes32[]"}],"name":"MarketplacePurchaseBrightList","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"MarketplacePurchased","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"PurchasedAmountBrightList","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"PurchasedAmountPublic","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"SaleProceeds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UniqueSaleIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"bool","name":"State","type":"bool"}],"name":"_ChangeSaleActiveStateBrightList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"bool","name":"State","type":"bool"}],"name":"_ChangeSaleActiveStatePublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"SaleIndexes","type":"uint256[]"},{"internalType":"bool[]","name":"States","type":"bool[]"}],"name":"_ChangeSaleActiveStatesBrightList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"SaleIndexes","type":"uint256[]"},{"internalType":"bool[]","name":"States","type":"bool[]"}],"name":"_ChangeSaleActiveStatesPublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Amount","type":"uint256"}],"name":"_ChangeSaleAllocationBrightList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Amount","type":"uint256"}],"name":"_ChangeSaleAllocationPublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"address","name":"Contract","type":"address"}],"name":"_ChangeSaleContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"ERC_TYPE","type":"uint256"}],"name":"_ChangeSaleERC_TYPE","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Index","type":"uint256"}],"name":"_ChangeSaleEndingIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"string","name":"Name","type":"string"}],"name":"_ChangeSaleName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"address","name":"Operator","type":"address"}],"name":"_ChangeSaleOperator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Price","type":"uint256"}],"name":"_ChangeSalePriceBrightList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Price","type":"uint256"}],"name":"_ChangeSalePricePublic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"bytes32","name":"RootHash","type":"bytes32"}],"name":"_ChangeSaleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"uint256","name":"Index","type":"uint256"}],"name":"_ChangeSaleStartingIndex","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"}],"name":"_EndSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"PriceBrightList","type":"uint256"},{"internalType":"uint256","name":"PricePublic","type":"uint256"},{"internalType":"uint256","name":"StartingIndex","type":"uint256"},{"internalType":"uint256","name":"EndingIndex","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountBrightList","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountPublic","type":"uint256"},{"internalType":"uint256","name":"ERC_TYPE","type":"uint256"},{"internalType":"address","name":"ContractAddress","type":"address"},{"internalType":"address","name":"Operator","type":"address"},{"internalType":"bytes32","name":"Root","type":"bytes32"},{"internalType":"bool","name":"ActivePublic","type":"bool"},{"internalType":"bool","name":"ActiveBrightList","type":"bool"},{"internalType":"bool","name":"AllowMultiplePurchases","type":"bool"}],"internalType":"struct Marketplace.Sale","name":"NewSaleInstance","type":"tuple"}],"name":"_StartSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"PriceBrightList","type":"uint256"},{"internalType":"uint256","name":"PricePublic","type":"uint256"},{"internalType":"uint256","name":"StartingIndex","type":"uint256"},{"internalType":"uint256","name":"EndingIndex","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountBrightList","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountPublic","type":"uint256"},{"internalType":"uint256","name":"ERC_TYPE","type":"uint256"},{"internalType":"address","name":"ContractAddress","type":"address"},{"internalType":"address","name":"Operator","type":"address"},{"internalType":"bytes32","name":"Root","type":"bytes32"},{"internalType":"bool","name":"ActivePublic","type":"bool"},{"internalType":"bool","name":"ActiveBrightList","type":"bool"},{"internalType":"bool","name":"AllowMultiplePurchases","type":"bool"}],"internalType":"struct Marketplace.Sale[]","name":"NewSaleInstance","type":"tuple[]"}],"name":"_StartSales","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"Operator","type":"address"}],"name":"__OperatorAdd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"Operator","type":"address"}],"name":"__OperatorRemove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"__Withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"Recipient","type":"address"},{"internalType":"uint256","name":"Amount","type":"uint256"}],"name":"__WithdrawAmountToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"Recipient","type":"address"},{"internalType":"address","name":"ContractAddress","type":"address"}],"name":"__WithdrawERC20ToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"}],"name":"__WithdrawSaleProceeds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"Recipient","type":"address"},{"internalType":"uint256","name":"SaleIndex","type":"uint256"}],"name":"__WithdrawSaleProceedsToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"Recipient","type":"address"}],"name":"__WithdrawToAddress","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":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"Recipient","type":"address"},{"internalType":"uint256","name":"SaleIndex","type":"uint256"},{"internalType":"bytes32[]","name":"Proof","type":"bytes32[]"}],"name":"viewBrightListAllocation","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"SaleIndex","type":"uint256"}],"name":"viewSaleState","outputs":[{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"PriceBrightList","type":"uint256"},{"internalType":"uint256","name":"PricePublic","type":"uint256"},{"internalType":"uint256","name":"StartingIndex","type":"uint256"},{"internalType":"uint256","name":"EndingIndex","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountBrightList","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountPublic","type":"uint256"},{"internalType":"uint256","name":"ERC_TYPE","type":"uint256"},{"internalType":"address","name":"ContractAddress","type":"address"},{"internalType":"address","name":"Operator","type":"address"},{"internalType":"bytes32","name":"Root","type":"bytes32"},{"internalType":"bool","name":"ActivePublic","type":"bool"},{"internalType":"bool","name":"ActiveBrightList","type":"bool"},{"internalType":"bool","name":"AllowMultiplePurchases","type":"bool"}],"internalType":"struct Marketplace.Sale","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"SaleIndexes","type":"uint256[]"}],"name":"viewSaleStates","outputs":[{"components":[{"internalType":"string","name":"Name","type":"string"},{"internalType":"uint256","name":"PriceBrightList","type":"uint256"},{"internalType":"uint256","name":"PricePublic","type":"uint256"},{"internalType":"uint256","name":"StartingIndex","type":"uint256"},{"internalType":"uint256","name":"EndingIndex","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountBrightList","type":"uint256"},{"internalType":"uint256","name":"PurchaseableAmountPublic","type":"uint256"},{"internalType":"uint256","name":"ERC_TYPE","type":"uint256"},{"internalType":"address","name":"ContractAddress","type":"address"},{"internalType":"address","name":"Operator","type":"address"},{"internalType":"bytes32","name":"Root","type":"bytes32"},{"internalType":"bool","name":"ActivePublic","type":"bool"},{"internalType":"bool","name":"ActiveBrightList","type":"bool"},{"internalType":"bool","name":"AllowMultiplePurchases","type":"bool"}],"internalType":"struct Marketplace.Sale[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"}]