Skip to content

Feature/paymaster#411

Open
usebeforefree wants to merge 9 commits intorelease/reworked-stakingfrom
feature/paymaster
Open

Feature/paymaster#411
usebeforefree wants to merge 9 commits intorelease/reworked-stakingfrom
feature/paymaster

Conversation

@usebeforefree
Copy link
Contributor

No description provided.

@zsculac
Copy link
Contributor

zsculac commented Jun 19, 2025

Looks good @marko03kostic

Once this PR #405 is merged you might need to solve some merge conflicts.

Can you add tests for the PaymasterManager?


function deployPaymaster() external {
address paymasterAddress = address(new Paymaster(address(hub)));
address paymasterAddress = address(new Paymaster(address(hub), msg.sender));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can set a paymaster at deployment and add it to validPaymasters and deployedPaymasters. Can we add a function to deactivate/remove them as well? Sounds like a good thing to have in case of compromise or if the owner decides to shut it down

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw what do we used deployedPaymasters for? Cannot seem to find the use case for it anywhere

revert("Sender is not the KnowledgeCollection contract");
}

_transferTokens(knowledgeCollectionAddress, amount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we transfer tokens to the StakingStorage like we are doing in KnowledgeCollection.sol if paymaster is not valid?

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract Paymaster is Ownable(msg.sender) {
contract Paymaster is Ownable {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to emit events when adding or removing from allowed addresses. Same for funding and withdrawing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add the transfer ownership method to Paymaster

@@ -0,0 +1,432 @@
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't find these tests here:

  • insufficient Paymaster balance → expect TooLowBalance.
  • verify StakingStorage balance increases after coverCost

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants