Skip to content

Commit

Permalink
add conduit preapproved
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Jan 3, 2024
1 parent 39de6ce commit cfed827
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ERC721ContractMetadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {

import { ERC721A } from "ERC721A/ERC721A.sol";

import { ERC721AConduitPreapproved } from "./lib/ERC721AConduitPreapproved.sol";

import { TwoStepOwnable } from "utility-contracts/TwoStepOwnable.sol";

import { IERC2981 } from "openzeppelin-contracts/interfaces/IERC2981.sol";
Expand All @@ -24,7 +26,7 @@ import {
* with additional metadata and ownership capabilities.
*/
contract ERC721ContractMetadata is
ERC721A,
ERC721AConduitPreapproved,
TwoStepOwnable,
ISeaDropTokenContractMetadata
{
Expand Down Expand Up @@ -63,7 +65,7 @@ contract ERC721ContractMetadata is
* @notice Deploy the token contract with its name and symbol.
*/
constructor(string memory name, string memory symbol)
ERC721A(name, symbol)
ERC721AConduitPreapproved(name, symbol)
{}

/**
Expand Down
39 changes: 39 additions & 0 deletions src/lib/ERC721AConduitPreapproved.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

import { ERC721A } from "ERC721A/ERC721A.sol";

/**
* @title ERC721AConduitPreapproved
* @notice ERC721A with the OpenSea conduit preapproved.
*/
abstract contract ERC721AConduitPreapproved is ERC721A {
/// @dev The canonical OpenSea conduit.
address internal constant _CONDUIT =
0x1E0049783F008A0085193E00003D00cd54003c71;

/**
* @notice Deploy the token contract.
*
* @param name The name of the token.
* @param symbol The symbol of the token.
*/
constructor(
string memory name,
string memory symbol
) ERC721A(name, symbol) {}

/**
* @dev Returns if the `operator` is allowed to manage all of the
* assets of `owner`. Always returns true for the conduit.
*/
function isApprovedForAll(
address owner,
address operator
) public view virtual override returns (bool) {
if (operator == _CONDUIT) {
return true;
}
return ERC721A.isApprovedForAll(owner, operator);
}
}

0 comments on commit cfed827

Please sign in to comment.