Skip to content

Commit

Permalink
wip: fix solhint
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-roslaniec committed Apr 19, 2024
1 parent 070ca81 commit 377caca
Show file tree
Hide file tree
Showing 6 changed files with 1,207 additions and 691 deletions.
8 changes: 6 additions & 2 deletions contracts/contracts/coordination/GlobalAllowList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ contract GlobalAllowList is IEncryptionAuthorizer {
uint32 ritualId,
bytes memory evidence,
bytes memory ciphertextHeader
) internal view virtual {}
) internal view virtual {
// solhint-disable-previous-line no-empty-blocks
}

/**
* @notice Checks if an address is authorized for a ritual
Expand Down Expand Up @@ -119,7 +121,9 @@ contract GlobalAllowList is IEncryptionAuthorizer {
uint32 ritualId,
address[] calldata addresses,
bool value
) internal view virtual {}
) internal view virtual {
// solhint-disable-previous-line no-empty-blocks
}

/**
* @notice Authorizes a list of addresses for a ritual
Expand Down
3 changes: 2 additions & 1 deletion contracts/contracts/coordination/ManagedAllowList.sol
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ contract ManagedAllowList is GlobalAllowList {
) internal view override {
for (uint256 i = 0; i < addresses.length; i++) {
require(
authActions[ritualId] <
value &&
authActions[ritualId] <
subscription.authorizationActionsCap(ritualId, addresses[i]),
"Authorization cap exceeded"
);
Expand Down
12 changes: 6 additions & 6 deletions contracts/contracts/coordination/Subscription.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ abstract contract Subscription {
address subscriber;
}

Coordinator coordinator;
IERC20 feeToken;
Coordinator public coordinator;
IERC20 public feeToken;

// Mapping from subscription ID to subscription info
mapping(uint32 => SubscriptionInfo) public subscriptions;
Expand Down Expand Up @@ -122,7 +122,7 @@ abstract contract Subscription {
* @return True if the spender can spend from the subscription, false otherwise
*/
function canSpendFromSubscription(
uint32 subscriptionId,
uint32 subscriptionId, // TODO: Currently unused

Check failure on line 125 in contracts/contracts/coordination/Subscription.sol

View workflow job for this annotation

GitHub Actions / linting

Variable "subscriptionId" is unused
address spender
) public returns (bool) {
// By default, only coordinator can spend from subscription
Expand All @@ -135,7 +135,7 @@ abstract contract Subscription {
* @param amount The amount to spend
*/
function spendFromSubscription(uint32 subscriptionId, uint256 amount) external {
require(canSpendFromSubscription(subscriptionId, msg.sender));
require(canSpendFromSubscription(subscriptionId, msg.sender), "Unauthorized spender");
feeToken.safeTransferFrom(address(this), msg.sender, amount);
}

Expand Down Expand Up @@ -175,10 +175,10 @@ abstract contract Subscription {
* @dev This contract extends the Subscription contract and introduces a cap on the number of encryptors.
*/
contract UpfrontSubscriptionWithEncryptorsCap is Subscription {
uint256 constant DEFAULT_CAP = 1000;
uint256 public constant DEFAULT_CAP = 1000;

// Mapping from subscription ID to the number of authorization actions
mapping(uint32 => uint256) authorizationActionCaps;
mapping(uint32 => uint256) public authorizationActionCaps;

/**
* @notice Sets the coordinator and fee token contracts
Expand Down
6 changes: 1 addition & 5 deletions contracts/test/EncryptionAuthorizerTestSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

pragma solidity ^0.8.0;


contract CoordinatorForEncryptionAuthorizerMock {

uint32 public numberOfRituals;
mapping(uint32 => address) public getAuthority;
mapping(uint32 => bool) public isRitualActive;
Expand All @@ -17,12 +15,10 @@ contract CoordinatorForEncryptionAuthorizerMock {

function mockEndRitual(uint32 ritualId) external {
isRitualActive[ritualId] = false;
}
}
}


contract SubscriptionForManagedAllowListMock {

uint32 public numberOfRituals;
mapping(uint32 => address) public getAuthority;
mapping(uint32 => bool) public isRitualActive;
Expand Down
Loading

0 comments on commit 377caca

Please sign in to comment.