Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade HolographDropERC721 #228

Merged
merged 27 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
787dd53
Initial changes for upgrading HolographDropERC721
alexanderattar Feb 7, 2024
fdc3fc3
Add code to use HolographGenesisLocal and debugging logs
alexanderattar Feb 12, 2024
aefc307
Add HolographGenesisLocal and deployment script for it on localhost
alexanderattar Feb 12, 2024
a791148
Cleanup debug code in sources deploy script
alexanderattar Feb 12, 2024
dbde601
Update Constants to support new localhost V2 addresses from Holograph…
alexanderattar Feb 13, 2024
c85cc2a
Update forge constants file
alexanderattar Feb 13, 2024
5cf6fc5
Update version number to 2.0.0
alexanderattar Feb 13, 2024
b299a4b
Move the holograph mint fee to the treasury
alexanderattar Feb 14, 2024
6b7216a
Switch to using HolographTreasuryInterface
alexanderattar Feb 14, 2024
00d3a96
Fix issue with stopping prank in foundry test
alexanderattar Feb 15, 2024
250dcc3
Fix wrong value test to check for exact custom error
alexanderattar Feb 15, 2024
c6ef250
Minor variable cleanup
alexanderattar Feb 15, 2024
1961246
Remove unused event types and add configure-events script
alexanderattar Feb 15, 2024
c0ca599
Add logic to identify the events that are registered
alexanderattar Feb 16, 2024
009ef46
Comments
alexanderattar Feb 16, 2024
441bf55
Better comments on event config functions
alexanderattar Feb 16, 2024
0402c68
Remove erc721TransferHelper
alexanderattar Feb 16, 2024
d5d6450
Add latest deployments and abis
alexanderattar Feb 20, 2024
afc833e
Add support for HolographDropERC721V2
alexanderattar Feb 22, 2024
d070d5e
Fix some misconfigurations
alexanderattar Feb 22, 2024
4f29bb0
Add latest deployments
alexanderattar Feb 22, 2024
7ea3a22
Add latest abis
alexanderattar Feb 22, 2024
fe65f97
Rename forge test directory foundry / add a note about reserved names…
alexanderattar Feb 23, 2024
c820134
Reenable all contracts for verify script
alexanderattar Feb 23, 2024
825318f
Add better comments for the reserved namespaces logic in register tem…
alexanderattar Feb 23, 2024
1c947d2
Add initial version of precompute hashes script
alexanderattar Feb 24, 2024
b50db46
Add mainnet and testnet deployments
alexanderattar Feb 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
212 changes: 212 additions & 0 deletions contracts/HolographGenesisLocal.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
// SPDX-License-Identifier: UNLICENSED
/*

┌───────────┐
│ HOLOGRAPH │
└───────────┘
╔═════════════════════════════════════════════════════════════╗
║ ║
║ / ^ \ ║
║ ~~*~~ ¸ ║
║ [ '<>:<>' ] │░░░ ║
║ ╔╗ _/"\_ ╔╣ ║
║ ┌─╬╬─┐ """ ┌─╬╬─┐ ║
║ ┌─┬┘ ╠╣ └┬─┐ \_/ ┌─┬┘ ╠╣ └┬─┐ ║
║ ┌─┬┘ │ ╠╣ │ └┬─┐ ┌─┬┘ │ ╠╣ │ └┬─┐ ║
║ ┌─┬┘ │ │ ╠╣ │ │ └┬─┐ ┌─┬┘ │ │ ╠╣ │ │ └┬─┐ ║
║ ┌─┬┘ │ │ │ ╠╣ │ │ │ └┬┐ ┌┬┘ │ │ │ ╠╣ │ │ │ └┬─┐ ║
╠┬┘ │ │ │ │ ╠╣ │ │ │ │└¤┘│ │ │ │ ╠╣ │ │ │ │ └┬╣
║│ │ │ │ │ ╠╣ │ │ │ │ │ │ │ │ ╠╣ │ │ │ │ │║
╠╩══╩══╩══╩══╩══╬╬══╩══╩══╩══╩═══╩══╩══╩══╩══╬╬══╩══╩══╩══╩══╩╣
╠┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴╬╬┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴╬╬┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴╣
║ ╠╣ ╠╣ ║
║ ╠╣ ╠╣ ║
║ , ╠╣ , ,' * ╠╣ ║
║~~~~~^~~~~~~~~┌╬╬┐~~~^~~~~~~~~^^~~~~~~~~^~~┌╬╬┐~~~~~~~^~~~~~~║
╚══════════════╩╩╩╩═════════════════════════╩╩╩╩══════════════╝
- one protocol, one bridge = infinite possibilities -


***************************************************************

DISCLAIMER: U.S Patent Pending

LICENSE: Holograph Limited Public License (H-LPL)

https://holograph.xyz/licenses/h-lpl/1.0.0

This license governs use of the accompanying software. If you
use the software, you accept this license. If you do not accept
the license, you are not permitted to use the software.

1. Definitions

The terms "reproduce," "reproduction," "derivative works," and
"distribution" have the same meaning here as under U.S.
copyright law. A "contribution" is the original software, or
any additions or changes to the software. A "contributor" is
any person that distributes its contribution under this
license. "Licensed patents" are a contributor’s patent claims
that read directly on its contribution.

2. Grant of Rights

A) Copyright Grant- Subject to the terms of this license,
including the license conditions and limitations in sections 3
and 4, each contributor grants you a non-exclusive, worldwide,
royalty-free copyright license to reproduce its contribution,
prepare derivative works of its contribution, and distribute
its contribution or any derivative works that you create.
B) Patent Grant- Subject to the terms of this license,
including the license conditions and limitations in section 3,
each contributor grants you a non-exclusive, worldwide,
royalty-free license under its licensed patents to make, have
made, use, sell, offer for sale, import, and/or otherwise
dispose of its contribution in the software or derivative works
of the contribution in the software.

3. Conditions and Limitations

A) No Trademark License- This license does not grant you rights
to use any contributors’ name, logo, or trademarks.
B) If you bring a patent claim against any contributor over
patents that you claim are infringed by the software, your
patent license from such contributor is terminated with
immediate effect.
C) If you distribute any portion of the software, you must
retain all copyright, patent, trademark, and attribution
notices that are present in the software.
D) If you distribute any portion of the software in source code
form, you may do so only under this license by including a
complete copy of this license with your distribution. If you
distribute any portion of the software in compiled or object
code form, you may only do so under a license that complies
with this license.
E) The software is licensed “as-is.” You bear all risks of
using it. The contributors give no express warranties,
guarantees, or conditions. You may have additional consumer
rights under your local laws which this license cannot change.
To the extent permitted under your local laws, the contributors
exclude all implied warranties, including those of
merchantability, fitness for a particular purpose and
non-infringement.

4. (F) Platform Limitation- The licenses granted in sections
2.A & 2.B extend only to the software or derivative works that
you create that run on a Holograph system product.

***************************************************************

*/

pragma solidity 0.8.13;

import "./interface/InitializableInterface.sol";

/**
* @title HOLOGRAPH GENESIS
* @dev In the beginning there was a smart contract...
*/
contract HolographGenesisLocal {
uint32 private immutable _version;

// Immutable addresses of the initial deployers
address private immutable deployer1 = 0xdf5295149F367b1FBFD595bdA578BAd22e59f504;

// Mapping of addresses that are approved deployers
mapping(address => bool) private _approvedDeployers;

// Events
event Message(string message);
event ContractDeployed(address deployedContract);

// Modifier to restrict function calls to approved deployers
modifier onlyDeployer() {
require(_approvedDeployers[msg.sender], "HOLOGRAPH: deployer not approved");
_;
}

/**
* @dev Sets the initial deployers as approved upon contract creation.
*/
constructor() {
_version = 2;

// Set the immutable deployers as approved
_approvedDeployers[deployer1] = true;

emit Message("The future is Holographic");
}

/**
* @dev Deploy a contract using the EIP-1014 (create2) opcode for deterministic addresses.
* @param chainId The chain on which to deploy
* @param saltHash A unique salt for contract creation
* @param secret A secret part of the salt
* @param sourceCode The bytecode of the contract to deploy
* @param initCode The initialization code for the contract
*/
function deploy(
uint256 chainId,
bytes12 saltHash,
bytes20 secret,
bytes memory sourceCode,
bytes memory initCode
) external onlyDeployer {
require(chainId == block.chainid, "HOLOGRAPH: incorrect chain id");
bytes32 salt = bytes32(abi.encodePacked(secret, saltHash));
address contractAddress = address(
uint160(uint256(keccak256(abi.encodePacked(bytes1(0xff), address(this), salt, keccak256(sourceCode)))))
);
require(!_isContract(contractAddress), "HOLOGRAPH: already deployed");
assembly {
contractAddress := create2(0, add(sourceCode, 0x20), mload(sourceCode), salt)
}
require(_isContract(contractAddress), "HOLOGRAPH: deployment failed");
require(
InitializableInterface(contractAddress).init(initCode) == InitializableInterface.init.selector,
"HOLOGRAPH: initialization failed"
);

emit ContractDeployed(contractAddress);
}

/**
* @dev Approve or revoke an address as a deployer.
* @param newDeployer Address to approve or revoke
* @param approve Boolean to approve or revoke
*/
function approveDeployer(address newDeployer, bool approve) external onlyDeployer {
_approvedDeployers[newDeployer] = approve;
}

/**
* @dev Check if an address is an approved deployer.
* @param deployer Address to check
* @return bool representing approval status
*/
function isApprovedDeployer(address deployer) external view returns (bool) {
return _approvedDeployers[deployer];
}

/**
* @dev Internal function to determine if an address is a deployed contract.
* @param contractAddress The address to check
* @return bool representing if the address is a contract
*/
function _isContract(address contractAddress) internal view returns (bool) {
bytes32 codehash;
assembly {
codehash := extcodehash(contractAddress)
}
return (codehash != 0x0 && codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470);
}

/**
* @dev Returns the version number of the Genesis contract
* @return uint32 representing the version number
*/
function getVersion() external view returns (uint32) {
return _version;
}
}
24 changes: 24 additions & 0 deletions contracts/HolographTreasury.sol
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ contract HolographTreasury is Admin, Initializable, HolographTreasuryInterface {
*/
bytes32 constant _registrySlot = 0xce8e75d5c5227ce29a4ee170160bb296e5dea6934b80a9bd723f7ef1e7c850e7;

/**
* @dev Holograph Mint Fee is can be used to charge a flat fee for minting
*/
uint256 public holographMintFee;

/**
* @dev Constructor is left empty and init is used instead
*/
Expand All @@ -164,6 +169,9 @@ contract HolographTreasury is Admin, Initializable, HolographTreasuryInterface {
sstore(_operatorSlot, operator)
sstore(_registrySlot, registry)
}

holographMintFee = 1000000; // $1.00 USD (6 decimal places)

_setInitialized();
return InitializableInterface.init.selector;
}
Expand Down Expand Up @@ -272,6 +280,22 @@ contract HolographTreasury is Admin, Initializable, HolographTreasuryInterface {
}
}

/**
* @notice Get the Holograph Mint Fee
* @dev This fee is charged to mint holographable assets
*/
function getHolographMintFee() external view returns (uint256) {
return holographMintFee;
}

/**
* @notice Update the Holograph Mint Fee
* @param fee new fee to charge for minting holographable assets
*/
function setHolographMintFee(uint256 fee) external onlyAdmin {
holographMintFee = fee;
}

/**
* @notice Withdraws native tokens from the contract
* @dev Can only be called by the admin
Expand Down
18 changes: 6 additions & 12 deletions contracts/drops/interface/IHolographDropERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ interface IHolographDropERC721 {
/// @notice Call to external metadata renderer failed.
error ExternalMetadataRenderer_CallFailed();

/// @notice Thrown when the operator for the contract is not allowed
/// @dev Used when strict enforcement of marketplaces for creator royalties is desired.
error OperatorNotAllowed(address operator);

/// @notice Thrown when there is no active market filter DAO address supported for the current chain
/// @dev Used for enabling and disabling filter for the given chain.
error MarketFilterDAOAddressNotSupportedForChain();

/// @notice Used when the operator filter registry external call fails
/// @dev Used for bubbling error up to clients.
error RemoteOperatorFilterRegistryCallFailed();

// Sale/Purchase errors
/// @notice Sale is inactive
error Sale_Inactive();
Expand Down Expand Up @@ -107,6 +95,12 @@ interface IHolographDropERC721 {
/// @param renderer new metadata renderer address
event UpdatedMetadataRenderer(address sender, IMetadataRenderer renderer);

/// @notice Event emitted when an nfs is minted
/// @param recipient address that the nft was minted to
/// @param tokenId id of the minted nft
/// @param id id of the minted nft with chain id prefix
event NFTMinted(address indexed recipient, uint256 indexed tokenId, uint256 id);

/// @notice Admin function to update the sales configuration settings
/// @param publicSalePrice public sale price in ether
/// @param maxSalePurchasePerAddress Max # of purchases (public) per address allowed
Expand Down
53 changes: 0 additions & 53 deletions contracts/drops/interface/IOperatorFilterRegistry.sol

This file was deleted.

3 changes: 0 additions & 3 deletions contracts/drops/struct/DropsInitializer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pragma solidity 0.8.13;
import {SalesConfiguration} from "./SalesConfiguration.sol";

/// @param erc721TransferHelper Transfer helper contract
/// @param marketFilterAddress Market filter address - Manage subscription to the for marketplace filtering based off royalty payouts.
/// @param initialOwner User that owns and can mint the edition, gets royalty and sales payouts and can update the base url if needed.
/// @param fundsRecipient Wallet/user that receives funds from sale
/// @param editionSize Number of editions that can be minted in total. If type(uint64).max, unlimited editions can be minted as an open edition.
Expand All @@ -15,12 +14,10 @@ import {SalesConfiguration} from "./SalesConfiguration.sol";
/// @param metadataRendererInit Renderer data initial contract
struct DropsInitializer {
address erc721TransferHelper;
address marketFilterAddress;
address initialOwner;
address payable fundsRecipient;
uint64 editionSize;
uint16 royaltyBPS;
bool enableOpenSeaRoyaltyRegistry;
SalesConfiguration salesConfiguration;
address metadataRenderer;
bytes metadataRendererInit;
Expand Down
Loading
Loading