Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 10 additions & 1 deletion contracts/art-token/ArtToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {Roles} from "../utils/Roles.sol";
import {IAuctionHouse} from "../auction-house/IAuctionHouse.sol";
import {ArtTokenConfigManager} from "./art-token-config-manager/ArtTokenConfigManager.sol";
import {TokenMintingPermit} from "./libraries/TokenMintingPermit.sol";
import {ArtTokenRoyaltyManager} from "./ArtTokenRoyaltyManager.sol";
import {ArtTokenBase} from "./ArtTokenBase.sol";
import {IArtToken} from "./IArtToken.sol";

Expand All @@ -22,7 +23,15 @@ import {IArtToken} from "./IArtToken.sol";
* logic, integrates EIP-712 permits and enforces optional transfer
* restrictions for regulated collections.
*/
contract ArtToken is IArtToken, ArtTokenBase, EIP712Domain, RoleSystem, Authorization, ArtTokenConfigManager {
contract ArtToken is
IArtToken,
ArtTokenBase,
EIP712Domain,
RoleSystem,
Authorization,
ArtTokenConfigManager,
ArtTokenRoyaltyManager
{
// TODO: need to implement method for validation mint conditions (tokenId, URI, config, etc)
using SafeERC20 for IERC20;
using TokenMintingPermit for TokenMintingPermit.Type;
Expand Down
11 changes: 7 additions & 4 deletions contracts/art-token/ArtTokenBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import {
import {
ERC721EnumerableUpgradeable
} from "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol";
import {IERC165} from "@openzeppelin/contracts/interfaces/IERC165.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol";

/**
* @title ArtTokenBase
Expand All @@ -17,7 +19,7 @@ import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
* protocol's ArtToken contracts. Relies on OpenZeppelin upgradeable libraries and
* bundles the Enumerable and URIStorage extensions in a single inheritance tree.
*/
abstract contract ArtTokenBase is ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable {
abstract contract ArtTokenBase is ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, IERC2981 {
/**
* @notice Initializes the token with a `name` and a `symbol`.
*
Expand Down Expand Up @@ -58,12 +60,13 @@ abstract contract ArtTokenBase is ERC721EnumerableUpgradeable, ERC721URIStorageU
}

/**
* @dev An override required by Solidity.
* @notice Returns true if the contract implements the interface defined by
* `interfaceId`. See the corresponding EIP-165 standard for more details.
*/
function supportsInterface(
bytes4 interfaceId
) public view override(ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable) returns (bool) {
return super.supportsInterface(interfaceId);
) public view override(ERC721EnumerableUpgradeable, ERC721URIStorageUpgradeable, IERC165) returns (bool) {
return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId);
}

/**
Expand Down
42 changes: 42 additions & 0 deletions contracts/art-token/ArtTokenRoyaltyManager.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.20;

import {IERC2981} from "@openzeppelin/contracts/interfaces/IERC2981.sol";
import {ArtTokenConfigManager} from "./art-token-config-manager/ArtTokenConfigManager.sol";

/**
* @title ArtTokenRoyaltyManager
*
* @notice Abstract contract that provides a basic implementation of the EIP-2981 royalty standard.
*
* @dev This implementation calculates a fixed 5% royalty on the sale price and designates the
* original token creator as the royalty recipient.
*/
abstract contract ArtTokenRoyaltyManager is IERC2981, ArtTokenConfigManager {
/**
* @notice The royalty percentage in basis points (500 = 5%).
*/
uint256 public constant ROYALTY_PERCENT_IN_BP = 500; // 5%

/**
* @notice One hundred percent represented in basis points (10000 = 100%).
*/
uint256 public constant ONE_HUNDRED_PERCENT_IN_BP = 10000; // 100% in basis points

/**
* @notice Calculates the royalty payment for a token sale, returning the recipient's address and the royalty amount.
*
* @param tokenId The ID of the token for which royalty information is being requested.
* @param salePrice The price at which the token was sold.
*
* @return receiver The address that should receive the royalty payment.
* @return royaltyAmount The amount of the royalty payment.
*/
function royaltyInfo(
uint256 tokenId,
uint256 salePrice
) external view returns (address receiver, uint256 royaltyAmount) {
receiver = _tokenCreator(tokenId);
royaltyAmount = (salePrice * ROYALTY_PERCENT_IN_BP) / ONE_HUNDRED_PERCENT_IN_BP;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.20;

import {RoleSystem} from "../../utils/role-system/RoleSystem.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/currency-manager/CurrencyManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.20;

import {RoleSystem} from "../role-system/RoleSystem.sol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.20;

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/currency-manager/ICurrencyManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: MIT
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.20;

/**
Expand Down