Skip to content

Commit

Permalink
fix: example
Browse files Browse the repository at this point in the history
  • Loading branch information
geolffreym committed Sep 15, 2024
1 parent b83984c commit cd585fe
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 35 deletions.
18 changes: 9 additions & 9 deletions contracts/RightsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ contract RightsManager is
emit RightsRevoked(policy, holder);
}

/// @inheritdoc IRightsDealBroker
/// @inheritdoc IRightsManager
/// @notice Calculates the fees for both the treasury and the distributor based on the provided total amount.
/// @dev This function handles the fee calculation for the treasury and negotiates the distribution fees with the distributor.

Check failure on line 330 in contracts/RightsManager.sol

View workflow job for this annotation

GitHub Actions / solhint linting

Line length must be no more than 120 but current length is 130
/// If the distributor or treasury does not support the specified currency, the function will revert.
Expand Down Expand Up @@ -392,14 +392,14 @@ contract RightsManager is
return _createProof(deal);
}

/// @inheritdoc IRightsDealBroker
/// @notice Close the deal by confirming the terms and executing the necessary transactions.
/// @dev This function finalizes the deal created by the account. It validates the proposal,
/// executes the agreed terms, and allocates payments.
/// @param dealProof The unique identifier of the created deal.
/// @param policyAddress The address of the policy contract that governs the terms.
/// @param data Additional data required to close the deal.
function closeDeal(
/// @inheritdoc IRightsManager
/// @notice Finalizes the deal by registering the agreed-upon policy, effectively closing the deal.
/// @dev This function verifies the policy's authorization, executes the deal, processes financial transactions,
/// and registers the policy in the system, representing the formal closure of the deal.
/// @param dealProof The unique identifier of the deal to be enforced.
/// @param policyAddress The address of the policy contract managing the deal.
/// @param data Additional data required to execute the deal.
function registerPolicy(
bytes32 dealProof,
address policyAddress,
bytes calldata data
Expand Down
24 changes: 0 additions & 24 deletions contracts/interfaces/IRightsDealBroker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,4 @@ interface IRightsDealBroker {
address holder,
address account
) external returns (bytes32);

/// @notice Finalizes the deal by registering the agreed-upon policy, effectively closing the deal.
/// @dev This function verifies the policy's authorization, executes the deal, processes financial transactions,
/// and registers the policy in the system, representing the formal closure of the deal.
/// @param dealProof The unique identifier of the deal to be enforced.
/// @param policyAddress The address of the policy contract managing the deal.
/// @param data Additional data required to execute the deal.
function closeDeal(
bytes32 dealProof,
address policyAddress,
bytes calldata data
) external payable;

/// @notice Calculates the fees for both the treasury and the distributor based on the provided total amount.
/// @param total The total amount involved in the transaction.
/// @param currency The address of the ERC20 token (or native currency) being used in the transaction.
/// @param holder The address of the content holder whose content is being accessed.
/// @return treasury The calculated fee for the treasury.
/// @return distribution The calculated fee for the distributor.
function calcFees(
uint256 total,
address currency,
address holder
) external returns (uint256, uint256);
}
24 changes: 24 additions & 0 deletions contracts/interfaces/IRightsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ interface IRightsManager is
IBalanceManagerWithdrawable,
IRightsPolicyAuditor
{
/// @notice Calculates the fees for both the treasury and the distributor based on the provided total amount.
/// @param total The total amount involved in the transaction.
/// @param currency The address of the ERC20 token (or native currency) being used in the transaction.
/// @param holder The address of the content holder whose content is being accessed.
/// @return treasury The calculated fee for the treasury.
/// @return distribution The calculated fee for the distributor.
function calcFees(
uint256 total,
address currency,
address holder
) external returns (uint256, uint256);

/// @notice Checks if the content is eligible for distribution by the content holder's custodial.
/// @param contentId The ID of the content to check for distribution eligibility.
/// @param contentHolder The address of the content holder whose custodial rights are being checked.
Expand All @@ -35,4 +47,16 @@ interface IRightsManager is
uint256 contentId,
address contentHolder
) external returns (bool);

/// @notice Finalizes the deal by registering the agreed-upon policy, effectively closing the deal.
/// @dev This function verifies the policy's authorization, executes the deal, processes financial transactions,
/// and registers the policy in the system, representing the formal closure of the deal.
/// @param dealProof The unique identifier of the deal to be enforced.
/// @param policyAddress The address of the policy contract managing the deal.
/// @param data Additional data required to execute the deal.
function registerPolicy(
bytes32 dealProof,
address policyAddress,
bytes calldata data
) external payable;
}
2 changes: 1 addition & 1 deletion contracts/syndication/Syndication.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ contract Syndication is
/// @notice Returns the contract's balance for the specified currency.
/// @param currency The address of the token to check the balance of (address(0) for native currency).
/// @return The balance of the contract in the specified currency.
function getBalance(address currency) external returns (uint256) {
function getBalance(address currency) external view returns (uint256) {
return address(this).balanceOf(currency);
}

Expand Down
3 changes: 2 additions & 1 deletion examples/GatedPolicy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ contract GatedContentPolicy is BasePolicy, IPolicy {
T.Deal calldata deal,
bytes calldata data
) external onlyRM returns (bool, string memory) {
if (comply(deal.account, deal.contentId)) {
uint256 contentId = abi.decode(data, (uint256));
if (comply(deal.account, contentId)) {
return (true, "Access granted");
} else {
return (false, "Access denied");
Expand Down

0 comments on commit cd585fe

Please sign in to comment.