-
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
Link liquidity pool, add withdraw functions for finance team and some refactoring #12375
Conversation
I see that you haven't updated any README files. Would it make sense to do so? |
Go solidity wrappers are out-of-date, regenerate them via the |
@@ -295,7 +298,6 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { | |||
*/ | |||
struct State { |
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.
we actually have to keep this struct as-is for backwards compatibility :/
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.
but I'm happy to just return 0 for this field in the getState()
function
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.
Got it, we kept the field name as is in this PR. we use the new s_reserveLinkBalance as the return value in getState() [ref] Does this look good?
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.
we will return 0 once we change the s_reserveLinkBalance to a mapping. very soon, in the next PR!
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.
could we revert this change in this PR? sorry to be nit-picky but this essentially breaks our backwards compatibility and I don't want to forget to fix it in a later PR.
error OnlyFinanceAdmin(); | ||
error TransferFailed(); | ||
error InsufficientBalance(uint256 available, uint256 requested); |
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.
nitpick - can we keep 'em alphabetized :)))
@@ -276,14 +279,14 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { | |||
address upkeepPrivilegeManager; | |||
IChainModule chainModule; | |||
bool reorgProtectionEnabled; | |||
address financeAdmin; |
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.
could we add a TODO comment to struct pack this better? We can address in a follow up PR.
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.
_onlyFinanceAdminAllowed(); | ||
if (to == ZERO_ADDRESS) revert InvalidRecipient(); | ||
|
||
bool transferStatus = IERC20(assetAddress).transfer(to, amount); |
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.
here, can we check the reserve amount for the taken being transferred?
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.
just to confirm, you meant IERC20(assetAddress).balanceOf(registryMasterAddress) should be smaller? add a require statement here?
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.
If we are on the same page, we actually have foundry tests covering the above:
assertEq(getNonLinkBalance(address(aMockAddress)), 1);
assertEq(getNonLinkBalance(address(registryMaster)), 1e10 - 1);
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.
we can do this in the follow up PR, where we convert the reserve amount to a mapping :)
46d20bc
to
1126f0f
Compare
1126f0f
to
f3add8e
Compare
contracts/src/v0.8/automation/dev/test/AutomationRegistry2_3.t.sol
Outdated
Show resolved
Hide resolved
contracts/src/v0.8/automation/dev/test/AutomationRegistry2_3.t.sol
Outdated
Show resolved
Hide resolved
contracts/src/v0.8/automation/dev/test/AutomationRegistry2_3.t.sol
Outdated
Show resolved
Hide resolved
contracts/src/v0.8/automation/dev/test/AutomationRegistry2_3.t.sol
Outdated
Show resolved
Hide resolved
contracts/src/v0.8/automation/dev/test/AutomationRegistry2_3.t.sol
Outdated
Show resolved
Hide resolved
//change back to the original address | ||
changePrank(originalAddr); |
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.
I think this pattern of pranking is a touch verbose - I think we could simplify like this...
// set config with the finance admin
setConfigForWithdraw();
// try to withdraw 1 link while there is 0 balance
vm.expectRevert(abi.encodeWithSelector(IAutomationRegistryMaster2_3.InsufficientBalance.selector, 0, 1));
vm.prank(FINANCE_ADMIN_ADDRESS);
registryMaster.withdrawLinkFees(aMockAddress, 1);
... or ...
// set config with the finance admin
setConfigForWithdraw();
vm.startPrank(FINANCE_ADMIN_ADDRESS); // better if we have to make more than 1 call
// try to withdraw 1 link while there is 0 balance
vm.expectRevert(abi.encodeWithSelector(IAutomationRegistryMaster2_3.InsufficientBalance.selector, 0, 1));
registryMaster.withdrawLinkFees(aMockAddress, 1);
vm.stopPrank();
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.
I also wouldn't be opposed to adding a vm.stopPrank()
at the end of setup()
- this guarantees us a "clean state" at the beginning of every test
f3add8e
to
693316c
Compare
693316c
to
18ce03a
Compare
Go solidity wrappers are out-of-date, regenerate them via the |
1 similar comment
Go solidity wrappers are out-of-date, regenerate them via the |
61bccc0
to
2aaf4cf
Compare
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.
2 super small requests
contracts/src/v0.8/automation/dev/test/AutomationRegistry2_3.t.sol
Outdated
Show resolved
Hide resolved
@@ -295,7 +298,6 @@ abstract contract AutomationRegistryBase2_3 is ConfirmedOwner { | |||
*/ | |||
struct State { |
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.
could we revert this change in this PR? sorry to be nit-picky but this essentially breaks our backwards compatibility and I don't want to forget to fix it in a later PR.
contracts/src/v0.8/automation/dev/v2_3/AutomationRegistryLogicB2_3.sol
Outdated
Show resolved
Hide resolved
7cdad21
to
42a30eb
Compare
Go solidity wrappers are out-of-date, regenerate them via the |
1 similar comment
Go solidity wrappers are out-of-date, regenerate them via the |
0fe802e
to
feb1514
Compare
Quality Gate passedIssues Measures |
event FundsAdded(uint256 indexed id, address indexed from, uint96 amount); | ||
event FundsWithdrawn(uint256 indexed id, uint256 amount, address to); | ||
event InsufficientFundsUpkeepReport(uint256 indexed id, bytes trigger); | ||
event OwnerFundsWithdrawn(uint96 amount); |
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.
can we keep this event? if not, it won't be compatible with existing atlas.
@cmalec what do you think?
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.
looks good from my end - can we confirm with @cmalec that changing / removing that OwnerFundsWithdrawn
event isn't important?
… refactoring (#12375) * add financeAdmin to onchainConfig * remove ownerLinkbalance and rename expectedLinkBalance * add withdraw functions * add foundry test and generate wrappers
… refactoring (#12375) * add financeAdmin to onchainConfig * remove ownerLinkbalance and rename expectedLinkBalance * add withdraw functions * add foundry test and generate wrappers
AUTO-9114