Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
add interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Spablob committed Jan 31, 2024
1 parent fe3c3ba commit 5621cba
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 10 deletions.
44 changes: 36 additions & 8 deletions contracts/interfaces/modules/royalty/IRoyaltyModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,51 @@ pragma solidity ^0.8.23;

/// @title RoyaltyModule interface
interface IRoyaltyModule {
/// @notice Event emitted when a royalty policy is whitelisted
/// @param royaltyPolicy The address of the royalty policy
/// @param allowed Indicates if the royalty policy is whitelisted or not
event RoyaltyPolicyWhitelistUpdated(address royaltyPolicy, bool allowed);

/// @notice Event emitted when a royalty token is whitelisted
/// @param token The address of the royalty token
/// @param allowed Indicates if the royalty token is whitelisted or not
event RoyaltyTokenWhitelistUpdated(address token, bool allowed);

/// @notice Event emitted when a royalty policy is set
/// @param ipId The ipId
/// @param royaltyPolicy The address of the royalty policy
/// @param data The data to initialize the policy
event RoyaltyPolicySet(address ipId, address royaltyPolicy, bytes data);

/// @notice Event emitted when royalties are paid
/// @param receiverIpId The ipId that receives the royalties
/// @param payerIpId The ipId that pays the royalties
/// @param sender The address that pays the royalties on behalf of the payer ipId
/// @param token The token that is used to pay the royalties
/// @param amount The amount that is paid
event RoyaltyPaid(address receiverIpId, address payerIpId, address sender, address token, uint256 amount);

/// @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 Whitelist a royalty token
/// @param token The token address
/// @param allowed Indicates if the token is whitelisted or not
function whitelistRoyaltyToken(address token, bool allowed) external;

/// @notice Sets the royalty policy for an ipId
/// @param ipId The ipId
/// @param royaltyPolicy The address of the royalty policy
/// @param parentIpIds The parent ipIds
/// @param data The data to initialize the policy
function setRoyaltyPolicy(address ipId, address royaltyPolicy, bytes calldata data) external;
function setRoyaltyPolicy(address ipId, address royaltyPolicy, address[] calldata parentIpIds, bytes calldata data) external;

/// @notice Allows an IPAccount to pay royalties
/// @param ipId The ipId
/// @param token The token to pay the royalties in
/// @notice Allows a sender to to pay royalties on behalf of an ipId
/// @param receiverIpId The ipId that receives the royalties
/// @param payerIpId The ipId that pays the royalties
/// @param token The token to use to pay the royalties
/// @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);
function payRoyaltyOnBehalf(address receiverIpId, address payerIpId, address token, uint256 amount) external;
}
21 changes: 21 additions & 0 deletions contracts/interfaces/modules/royalty/policies/IClaimerLS.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

/// @title Liquid split policy claimer interface
interface IClaimerLS {
/// @notice Event emitted when a claim is made
/// @param path The path from the ipId to the claimer
/// @param claimer The claimer ipId address
/// @param withdrawETH Indicates if the claimer wants to withdraw ETH
/// @param tokens The ERC20 tokens to withdraw
event Claimed(address[] path, address claimer, bool withdrawETH, ERC20[] tokens);

/// @notice Allows an ipId to claim their rnfts and accrued royalties
/// @param path The path of the ipId
/// @param claimerIpId The ipId of the claimer
/// @param withdrawETH Indicates if the claimer wants to withdraw ETH
/// @param tokens The ERC20 tokens to withdraw
function claim(address[] calldata path, address claimerIpId, bool withdrawETH, ERC20[] calldata tokens) external;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,20 @@ interface ILiquidSplitClone {
/// @param accounts The accounts to distribute to
/// @param distributorAddress The distributor address
function distributeFunds(address token, address[] calldata accounts, address distributorAddress) external;

/// @notice Transfers rnft tokens
/// @param from The address to transfer from
/// @param to The address to transfer to
/// @param id The token id
/// @param amount The amount to transfer
/// @param data Custom data
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;

function balanceOf(address account, uint256 id) external view returns (uint256);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,13 @@ interface ILiquidSplitMain {
uint256 withdrawETH,
ERC20[] calldata tokens
) external;

/// @notice Gets the ETH balance of an account
/// @param account The account to get the ETH balance of
function getETHBalance(address account) external view returns (uint256);

/// @notice Gets the ERC20 balance of an account
/// @param account The account to get the ERC20 balance of
/// @param token The token to get the balance of
function getERC20Balance(address account, ERC20 token) external view returns (uint256);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ pragma solidity ^0.8.23;
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;
/// @param parentsIpIds The parent ipIds
/// @param data The data to initialize the policy
function initPolicy(address ipId, address[] calldata parentsIpIds, bytes calldata data) external;

/// @notice Allows to pay a royalty
/// @param caller The caller
Expand Down
38 changes: 38 additions & 0 deletions contracts/interfaces/modules/royalty/policies/IRoyaltyPolicyLS.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

import { IRoyaltyPolicy } from "contracts/interfaces/modules/royalty/policies/IRoyaltyPolicy.sol";

/// @title RoyaltyPolicy interface
interface IRoyaltyPolicyLS is IRoyaltyPolicy {
/// @notice Gets the royalty data
/// @param ipId The ipId
/// @return splitClone The split clone address
/// claimer The claimer address
/// royaltyStack The royalty stack
/// minRoyalty The min royalty
function royaltyData(address ipId) external view returns (address splitClone, address claimer, uint32 royaltyStack, uint32 minRoyalty);

/// @notice Distributes funds to the accounts in the LiquidSplitClone contract
/// @param ipId The ipId
/// @param token The token to distribute
/// @param accounts The accounts to distribute to
/// @param distributorAddress The distributor address
function distributeFunds(
address ipId,
address token,
address[] calldata accounts,
address distributorAddress
) external;

/// @notice Claims the available royalties for a given account
/// @param account The account to claim for
/// @param withdrawETH The amount of ETH to withdraw
/// @param tokens The tokens to withdraw
function claimRoyalties(address account, uint256 withdrawETH, ERC20[] calldata tokens) external;

/// @notice Gets liquid split main address
function LIQUID_SPLIT_MAIN() external view returns (address);
}

0 comments on commit 5621cba

Please sign in to comment.