-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FUN-1527 Add updateFromPrevious method to Functions ToS #13795
Changes from 18 commits
041314e
bea9eb5
6a3c3f1
b1fab51
d920cd5
79e76d4
b9bd2dc
47e335b
85f887d
93d2cf6
e44bb72
8afc399
c387b1d
8f4f6d6
2c389b1
6165bf6
4d7a859
af9cda3
3289f77
00826e2
ec0f31c
9e3c020
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"chainlink": patch | ||
--- | ||
|
||
Updated Functions ToS contract wrappers #internal |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@chainlink/contracts': patch | ||
--- | ||
|
||
Added updateFromPrevious method to Functions ToS contract |
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, | |
using EnumerableSet for EnumerableSet.AddressSet; | ||
|
||
/// @inheritdoc ITypeAndVersion | ||
string public constant override typeAndVersion = "Functions Terms of Service Allow List v1.1.0"; | ||
string public constant override typeAndVersion = "Functions Terms of Service Allow List v1.1.1"; | ||
address private s_previousToSContract; | ||
|
||
EnumerableSet.AddressSet private s_allowedSenders; | ||
EnumerableSet.AddressSet private s_blockedSenders; | ||
|
@@ -41,7 +42,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, | |
constructor( | ||
TermsOfServiceAllowListConfig memory config, | ||
address[] memory initialAllowedSenders, | ||
address[] memory initialBlockedSenders | ||
address[] memory initialBlockedSenders, | ||
address previousToSContract | ||
) ConfirmedOwner(msg.sender) { | ||
updateConfig(config); | ||
|
||
|
@@ -56,6 +58,8 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, | |
} | ||
s_blockedSenders.add(initialBlockedSenders[j]); | ||
} | ||
|
||
s_previousToSContract = previousToSContract; | ||
} | ||
|
||
// ================================================================ | ||
|
@@ -197,4 +201,17 @@ contract TermsOfServiceAllowList is ITermsOfServiceAllowList, IAccessController, | |
|
||
return blockedSenders; | ||
} | ||
|
||
function migratePreviouslyAllowedSenders(address[] memory previousSendersToAdd) external override onlyOwner { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💭 do we want to restrict this to be run only once? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking about something like that as well, but if the diff list gets too large it may need to be run more than once. |
||
require(s_previousToSContract != address(0), "No previous ToS contract"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should use a custom error, rather than a require statement. |
||
IAccessController previousToSContract = IAccessController(s_previousToSContract); | ||
for (uint256 i = 0; i < previousSendersToAdd.length; ++i) { | ||
if ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gas golf: If you split this into a nested if statement it saves 36 gas. This is because having them together spends the gas to evaluate each of them before doing the boolean logic. |
||
previousToSContract.hasAccess(previousSendersToAdd[i], "") && | ||
!s_blockedSenders.contains(previousSendersToAdd[i]) | ||
) { | ||
s_allowedSenders.add(previousSendersToAdd[i]); | ||
} | ||
} | ||
} | ||
} |
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing natspec inherit