forked from storyprotocol/protocol-core
-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Minting Fee and Receiver Check Hooks into Unified LicensingH…
…ook (#115) * Add Unified Licensing Hook * Refactor and add more tests
- Loading branch information
1 parent
96ebc7c
commit f559e0b
Showing
12 changed files
with
617 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.23; | ||
|
||
import { IModule } from "../base/IModule.sol"; | ||
|
||
/// @title ILicensingHook | ||
/// @notice This interface defines the hook functions that are called by the LicensingModule when | ||
/// executing licensing functions. | ||
/// IP owners can configure the hook to a specific license terms or all licenses of an IP Asset. | ||
/// @dev Developers can create a contract that implements this interface to implement various checks | ||
/// and determine the minting price. | ||
interface ILicensingHook is IModule { | ||
/// @notice This function is called when the LicensingModule mints license tokens. | ||
/// @dev The hook can be used to implement various checks and determine the minting price. | ||
/// The hook should revert if the minting is not allowed. | ||
/// @param caller The address of the caller who calling the mintLicenseTokens() function. | ||
/// @param licensorIpId The ID of licensor IP from which issue the license tokens. | ||
/// @param licenseTemplate The address of the license template. | ||
/// @param licenseTermsId The ID of the license terms within the license template, | ||
/// which is used to mint license tokens. | ||
/// @param amount The amount of license tokens to mint. | ||
/// @param receiver The address of the receiver who receive the license tokens. | ||
/// @param hookData The data to be used by the licensing hook. | ||
/// @return totalMintingFee The total minting fee to be paid when minting amount of license tokens. | ||
function beforeMintLicenseTokens( | ||
address caller, | ||
address licensorIpId, | ||
address licenseTemplate, | ||
uint256 licenseTermsId, | ||
uint256 amount, | ||
address receiver, | ||
bytes calldata hookData | ||
) external returns (uint256 totalMintingFee); | ||
|
||
/// @notice This function is called when the LicensingModule mints license tokens. | ||
/// @dev The hook can be used to implement various checks and determine the minting price. | ||
/// The hook should revert if the registering of derivative is not allowed. | ||
/// @param childIpId The derivative IP ID. | ||
/// @param parentIpId The parent IP ID. | ||
/// @param licenseTemplate The address of the license template. | ||
/// @param licenseTermsId The ID of the license terms within the license template. | ||
/// @param hookData The data to be used by the licensing hook. | ||
/// @return mintingFee The minting fee to be paid when register child IP to the parent IP as derivative. | ||
function beforeRegisterDerivative( | ||
address caller, | ||
address childIpId, | ||
address parentIpId, | ||
address licenseTemplate, | ||
uint256 licenseTermsId, | ||
bytes calldata hookData | ||
) external returns (uint256 mintingFee); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
contracts/interfaces/modules/licensing/IMintingFeeModule.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.