Skip to content

Commit 57da81b

Browse files
committed
todo: document improvements
1 parent 0f3477f commit 57da81b

File tree

5 files changed

+142
-14
lines changed

5 files changed

+142
-14
lines changed

contracts/financial/AgreementManager.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ contract AgreementManager is Initializable, UUPSUpgradeable, AccessControlledUpg
185185
/// @return The calculated fee amount based on the applicable fee scheme.
186186
function _calcFees(uint256 total, address target, address currency) private view returns (uint256) {
187187
// !IMPORTANT if fees manager does not support the currency or the target, will revert..
188+
// TODO avoid revert, just check if the currency is supported and return 0
188189
(uint256 fees, T.Scheme scheme) = TOLLGATE.getFees(target, currency);
189190
if (scheme == T.Scheme.BPS) return total.perOf(fees); // bps calc
190191
if (scheme == T.Scheme.NOMINAL) return total.perOf(fees.calcBps()); // nominal to bps

contracts/financial/AgreementSettler.sol

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,13 +166,33 @@ contract AgreementSettler is
166166
return agreement;
167167
}
168168

169+
// modifier hookExec(address counterParty) {
170+
// // get registered exec hooks for this contract
171+
// // IHook hook = HOOKS.get(address(this), arbitrer, IExecHook) <- internal handling of any logic needed
172+
// // to get the valid hook
173+
174+
// // if (hook) {
175+
// // // execute the hook logic, eg: royalties, splits, etc..
176+
// // // any error in the hook should revert the whole tx
177+
// // hook.prev(abi.encode(msg.sender, counterParty, proof));
178+
// // }
179+
// _;
180+
// // if (hook) {
181+
// // LEDGER_VAULT.approve(address(hook), available, currency);
182+
// // // execute the hook logic, eg: royalties, splits, etc..
183+
// // // any error in the hook should revert the whole tx
184+
// // hook.post(abi.encode(msg.sender, counterParty, proof));
185+
// // }
186+
187+
// }
188+
169189
/// @notice Settles an agreement by marking it inactive and transferring funds to the counterparty.
170190
/// @param proof The unique identifier of the agreement.
171191
/// @param counterparty The address that will receive the funds upon settlement.
172192
function settleAgreement(
173193
uint256 proof,
174194
address counterparty
175-
) public onlyValidAgreement(proof) returns (T.Agreement memory) {
195+
) public onlyValidAgreement(proof) /**hookExec(counterParty) */ returns (T.Agreement memory) {
176196
// retrieve the agreement to storage to inactivate it and return it
177197
T.Agreement memory agreement = AGREEMENT_MANAGER.getAgreement(proof);
178198
if (agreement.arbiter != msg.sender) revert UnauthorizedEscrowAgent();

contracts/rights/RightsPolicyManager.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ contract RightsPolicyManager is
7575
/// @param holder The address of the rights holder who must have authorized the policy.
7676
/// @param policy The address of the policy contract attempting to access the rights.
7777
modifier onlyAuthorizedPolicy(address holder, address policy) {
78+
require(policy != address(0), "Policy address cannot be zero");
7879
bool isPolicyAuthorizedByHolder = RIGHTS_AUTHORIZER.isPolicyAuthorized(policy, holder);
7980
if (!isPolicyAuthorizedByHolder) revert RightsNotDelegated(policy, holder);
8081
_;
@@ -192,6 +193,7 @@ contract RightsPolicyManager is
192193
/// @param account The address of the user whose compliance is being evaluated.
193194
/// @param policy The address of the policy contract to check compliance against.
194195
/// @param criteria Encoded data containing the parameters required to verify access.
196+
/// @return `true` if the policy is registered and active for the account, otherwise `false`.
195197
function isActivePolicy(address account, address policy, bytes memory criteria) public view returns (bool) {
196198
if (!isRegisteredPolicy(account, policy)) return false;
197199
return _verifyPolicyAccess(account, policy, criteria);

package-lock.json

Lines changed: 117 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"devDependencies": {
66
"dotenv": "^16.4.5",
77
"prettier-plugin-solidity": "^1.4.1",
8-
"solhint": "^5.0.4",
8+
"solhint": "^6.0.0",
99
"solhint-plugin-prettier": "^0.1.0",
1010
"solidity-code-metrics": "^0.0.28"
1111
},

0 commit comments

Comments
 (0)