forked from storyprotocol/protocol-core-v1
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: organize interfaces and add events (storyprotocol#22)
- Loading branch information
Showing
19 changed files
with
381 additions
and
77 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
interface IRegistrationModule { | ||
event RootIPRegistered(address indexed caller, address indexed ipId, uint256 indexed policyId); | ||
|
||
event DerivativeIPRegistered(address indexed caller, address indexed ipId, uint256 licenseId); | ||
|
||
function registerRootIp(uint256 policyId, address tokenContract, uint256 tokenId) external returns (address); | ||
|
||
function registerDerivativeIp( | ||
uint256 licenseId, | ||
address tokenContract, | ||
uint256 tokenId, | ||
string memory ipName, | ||
string memory ipDescription, | ||
bytes32 hash | ||
) external; | ||
} |
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,60 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
/// @title Dispute Module Interface | ||
interface IDisputeModule { | ||
/// @notice Whitelists a dispute tag | ||
/// @param tag The dispute tag | ||
/// @param allowed Indicates if the dispute tag is whitelisted or not | ||
function whitelistDisputeTags(bytes32 tag, bool allowed) external; | ||
|
||
/// @notice Whitelists an arbitration policy | ||
/// @param arbitrationPolicy The address of the arbitration policy | ||
/// @param allowed Indicates if the arbitration policy is whitelisted or not | ||
function whitelistArbitrationPolicy(address arbitrationPolicy, bool allowed) external; | ||
|
||
/// @notice Whitelists an arbitration relayer for a given arbitration policy | ||
/// @param arbitrationPolicy The address of the arbitration policy | ||
/// @param arbPolicyRelayer The address of the arbitration relayer | ||
/// @param allowed Indicates if the arbitration relayer is whitelisted or not | ||
function whitelistArbitrationRelayer(address arbitrationPolicy, address arbPolicyRelayer, bool allowed) external; | ||
|
||
/// @notice Raises a dispute | ||
/// @param ipId The ipId | ||
/// @param arbitrationPolicy The address of the arbitration policy | ||
/// @param linkToDisputeSummary The link of the dispute summary | ||
/// @param targetTag The target tag of the dispute | ||
/// @param data The data to initialize the policy | ||
/// @return disputeId The dispute id | ||
function raiseDispute( | ||
address ipId, | ||
address arbitrationPolicy, | ||
string memory linkToDisputeSummary, | ||
bytes32 targetTag, | ||
bytes calldata data | ||
) external returns (uint256 disputeId); | ||
|
||
/// @notice Sets the dispute judgement | ||
/// @param disputeId The dispute id | ||
/// @param decision The decision of the dispute | ||
/// @param data The data to set the dispute judgement | ||
function setDisputeJudgement(uint256 disputeId, bool decision, bytes calldata data) external; | ||
|
||
/// @notice Cancels an ongoing dispute | ||
/// @param disputeId The dispute id | ||
/// @param data The data to cancel the dispute | ||
function cancelDispute(uint256 disputeId, bytes calldata data) external; | ||
|
||
/// @notice Resolves a dispute after it has been judged | ||
/// @param disputeId The dispute id | ||
function resolveDispute(uint256 disputeId) external; | ||
|
||
/// @notice Gets the dispute struct characteristics | ||
function disputes(uint256 disputeId) external view returns ( | ||
address ipId, | ||
address disputeInitiator, | ||
address arbitrationPolicy, | ||
bytes32 linkToDisputeSummary, | ||
bytes32 tag | ||
); | ||
} |
17 changes: 17 additions & 0 deletions
17
contracts/interfaces/modules/dispute/policies/IArbitrationPolicy.sol
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,17 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
/// @title ArbitrationPolicy interface | ||
interface IArbitrationPolicy { | ||
/// @notice Executes custom logic on raise dispute | ||
/// @param caller Address of the caller | ||
function onRaiseDispute(address caller, bytes calldata data) external; | ||
|
||
/// @notice Executes custom logic on dispute judgement | ||
/// @param disputeId The dispute id | ||
/// @param decision The decision of the dispute | ||
function onDisputeJudgement(uint256 disputeId, bool decision, bytes calldata data) external; | ||
|
||
/// @notice Executes custom logic on dispute cancel | ||
function onDisputeCancel(address caller, uint256 disputeId, bytes calldata data) external; | ||
} |
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,25 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
/// @title RoyaltyModule interface | ||
interface IRoyaltyModule { | ||
/// @notice Whitelist a royalty policy | ||
/// @param royaltyPolicy The address of the royalty policy | ||
/// @param allowed Indicates if the royalty policy is whitelisted or not | ||
function whitelistRoyaltyPolicy(address royaltyPolicy, bool allowed) external; | ||
|
||
/// @notice Sets the royalty policy for an ipId | ||
/// @param ipId The ipId | ||
/// @param royaltyPolicy The address of the royalty policy | ||
/// @param data The data to initialize the policy | ||
function setRoyaltyPolicy(address ipId, address royaltyPolicy, bytes calldata data) external; | ||
|
||
/// @notice Allows an IPAccount to pay royalties | ||
/// @param ipId The ipId | ||
/// @param token The token to pay the royalties in | ||
/// @param amount The amount to pay | ||
function payRoyalty(address ipId, address token, uint256 amount) external; | ||
|
||
/// @notice Gets the royalty policy for a given ipId | ||
function royaltyPolicies(address ipId) external view returns (address royaltyPolicy); | ||
} |
11 changes: 11 additions & 0 deletions
11
contracts/interfaces/modules/royalty/policies/ILiquidSplitClone.sol
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,11 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
/// @title LiquidSplitClone interface | ||
interface ILiquidSplitClone { | ||
/// @notice Distributes funds to the accounts in the LiquidSplitClone contract | ||
/// @param token The token to distribute | ||
/// @param accounts The accounts to distribute to | ||
/// @param distributorAddress The distributor address | ||
function distributeFunds(address token, address[] calldata accounts, address distributorAddress) external; | ||
} |
17 changes: 17 additions & 0 deletions
17
contracts/interfaces/modules/royalty/policies/ILiquidSplitFactory.sol
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,17 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
/// @title LiquidSplitFactory interface | ||
interface ILiquidSplitFactory { | ||
/// @notice Creates a new LiquidSplitClone contract | ||
/// @param accounts The accounts to initialize the LiquidSplitClone contract with | ||
/// @param initAllocations The initial allocations | ||
/// @param _distributorFee The distributor fee | ||
/// @param owner The owner of the LiquidSplitClone contract | ||
function createLiquidSplitClone( | ||
address[] calldata accounts, | ||
uint32[] calldata initAllocations, | ||
uint32 _distributorFee, | ||
address owner | ||
) external returns (address); | ||
} |
17 changes: 17 additions & 0 deletions
17
contracts/interfaces/modules/royalty/policies/ILiquidSplitMain.sol
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,17 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
/// @title LiquidSplitMain interface | ||
interface ILiquidSplitMain { | ||
/// @notice Allows an account to withdraw their accrued and distributed pending amount | ||
/// @param account The account to withdraw from | ||
/// @param withdrawETH The amount of ETH to withdraw | ||
/// @param tokens The tokens to withdraw | ||
function withdraw( | ||
address account, | ||
uint256 withdrawETH, | ||
ERC20[] calldata tokens | ||
) external; | ||
} |
17 changes: 17 additions & 0 deletions
17
contracts/interfaces/modules/royalty/policies/IRoyaltyPolicy.sol
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,17 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.23; | ||
|
||
/// @title RoyaltyPolicy interface | ||
interface IRoyaltyPolicy { | ||
/// @notice Initializes the royalty policy | ||
/// @param ipId The ipId | ||
/// @param data The data to initialize the policy | ||
function initPolicy(address ipId, bytes calldata data) external; | ||
|
||
/// @notice Allows to pay a royalty | ||
/// @param caller The caller | ||
/// @param ipId The ipId | ||
/// @param token The token to pay | ||
/// @param amount The amount to pay | ||
function onRoyaltyPayment(address caller, address ipId, address token, uint256 amount) external; | ||
} |
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,79 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.23; | ||
|
||
import { Licensing } from "contracts/lib/Licensing.sol"; | ||
|
||
interface ILicenseRegistry { | ||
event LicenseFrameworkCreated( | ||
address indexed creator, | ||
uint256 indexed frameworkId, | ||
Licensing.FrameworkCreationParams frameworkCreationParams | ||
); | ||
|
||
event PolicyCreated(address indexed creator, uint256 indexed policyId, Licensing.Policy policy); | ||
|
||
event PolicyAddedToIpId(address indexed caller, address indexed ipId, uint256 indexed policyId); | ||
|
||
event LicenseMinted( | ||
address indexed creator, | ||
address indexed receiver, | ||
uint256 indexed licenseId, | ||
uint256 amount, | ||
Licensing.License licenseData | ||
); | ||
|
||
event IpIdLinkedToParent(address indexed caller, address indexed ipId, address indexed parentIpId); | ||
|
||
function addLicenseFramework( | ||
Licensing.FrameworkCreationParams calldata fwCreation | ||
) external returns (uint256 frameworkId); | ||
|
||
function addPolicyToIp( | ||
address ipId, | ||
Licensing.Policy memory pol | ||
) external returns (uint256 policyId, bool isNew, uint256 indexOnIpId); | ||
|
||
function addPolicyToIp(address ipId, uint256 polId) external returns (uint256 indexOnIpId); | ||
|
||
function addPolicy(Licensing.Policy memory pol) external returns (uint256 policyId, bool isNew); | ||
|
||
function mintLicense( | ||
Licensing.License calldata licenseData, | ||
uint256 amount, | ||
address receiver | ||
) external returns (uint256 licenseId); | ||
|
||
function linkIpToParent(uint256 licenseId, address childIpId, address holder) external; | ||
|
||
/// | ||
/// Getters | ||
/// | ||
|
||
function totalFrameworks() external view returns (uint256); | ||
|
||
function framework(uint256 frameworkId) external view returns (Licensing.Framework memory fw); | ||
|
||
function totalPolicies() external view returns (uint256); | ||
|
||
function policy(uint256 policyId) external view returns (Licensing.Policy memory pol); | ||
|
||
function isPolicyDefined(uint256 policyId) external view returns (bool); | ||
|
||
function policyIdsForIp(address ipId) external view returns (uint256[] memory policyIds); | ||
|
||
function totalPoliciesForIp(address ipId) external view returns (uint256); | ||
|
||
function isPolicyIdSetForIp(address ipId, uint256 policyId) external view returns (bool); | ||
|
||
function policyIdForIpAtIndex(address ipId, uint256 index) external view returns (uint256 policyId); | ||
|
||
function policyForIpAtIndex(address ipId, uint256 index) external view returns (Licensing.Policy memory); | ||
|
||
function isLicensee(uint256 licenseId, address holder) external view returns (bool); | ||
|
||
function isParent(address parentIpId, address childIpId) external view returns (bool); | ||
|
||
function parentIpIds(address ipId) external view returns (address[] memory); | ||
|
||
function totalParentsForIpId(address ipId) external view returns (uint256); | ||
} |
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.