Skip to content

Commit

Permalink
fix(topup): reset old keeper registry allowance
Browse files Browse the repository at this point in the history
  • Loading branch information
imollov committed May 29, 2024
1 parent afde372 commit 5c56e59
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions contracts/DssVestTopUp.sol
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ contract DssVestTopUp is IUpkeepRefunder, INetworkTreasury, Ownable {

function setKeeperRegistry(address _keeperRegistry) external onlyOwner {
if (_keeperRegistry == address(0)) revert InvalidParam("KeeperRegistry");
TransferHelper.safeApprove(linkToken, address(keeperRegistry), 0);
keeperRegistry = KeeperRegistryLike(_keeperRegistry);
TransferHelper.safeApprove(linkToken, _keeperRegistry, type(uint256).max);
emit KeeperRegistrySet(_keeperRegistry);
Expand Down
7 changes: 7 additions & 0 deletions test/unit/DssVestTopUp.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@ describe("DssVestTopUp", function () {
).to.eq(ethers.constants.MaxUint256);
});

it("should reset link token allowance to the old keeper registry", async function () {
await topUp.setKeeperRegistry(randomAddress.address);
expect(
await linkToken.allowance(topUp.address, keeperRegistryMock.address)
).to.eq(0);
});

it("should set upkeep id", async function () {
const newUpkeepId = 1;
await topUp.setUpkeepId(newUpkeepId);
Expand Down

0 comments on commit 5c56e59

Please sign in to comment.