Skip to content

Commit

Permalink
clean up natspec
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsoncusack committed Apr 4, 2024
1 parent ecf7c15 commit e5efda2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
22 changes: 11 additions & 11 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ IsValidWithdrawalSignature:test_returnsTrueWithValidSignature() (gas: 51016)
OwnerWithdrawTest:test_revertsIfNotOwner() (gas: 15305)
OwnerWithdrawTest:test_transfersERC20Successfully(uint256) (runs: 256, μ: 97271, ~: 99711)
OwnerWithdrawTest:test_transfersETHSuccessfully(uint256) (runs: 256, μ: 51418, ~: 53415)
PostOpTest:test_RevertsIfPostOpFailed(uint256,uint256,uint256) (runs: 256, μ: 97250, ~: 99371)
PostOpTest:test_RevertsIfPostOpFailed(uint256,uint256,uint256) (runs: 256, μ: 97229, ~: 99371)
PostOpTest:test_entryPointAddStake(uint112,uint32) (runs: 256, μ: 56278, ~: 56278)
PostOpTest:test_entryPointDeposit(uint112) (runs: 256, μ: 32383, ~: 32940)
PostOpTest:test_entryPointDeposit(uint112) (runs: 256, μ: 32457, ~: 32940)
PostOpTest:test_entryPointUnlockStake() (gas: 54933)
PostOpTest:test_entryPointWithdraw(uint112) (runs: 256, μ: 63521, ~: 65321)
PostOpTest:test_entryPointWithdraw(uint112) (runs: 256, μ: 63371, ~: 65321)
PostOpTest:test_entryPointWithdrawStake() (gas: 71848)
PostOpTest:test_paymasterPaysForOp() (gas: 210663)
PostOpTest:test_transfersExcess(uint256,uint256,uint256,uint256) (runs: 256, μ: 112468, ~: 113488)
PostOpTest:test_transfersExcess(uint256,uint256,uint256,uint256) (runs: 256, μ: 112452, ~: 113488)
SetMaxWithdrawPercent:test_emitsCorrectly(uint256) (runs: 256, μ: 19851, ~: 20191)
SetMaxWithdrawPercent:test_reverts_whenNotCalledByOwner() (gas: 12257)
SetMaxWithdrawPercent:test_setsMaxWithdrawPercent(uint256) (runs: 256, μ: 19209, ~: 19549)
Expand All @@ -23,16 +23,16 @@ ValidatePaymasterUserOpTest:test_returnsCorrectly() (gas: 91185)
ValidatePaymasterUserOpTest:test_revertsIfMaxCostMoreThanRequested() (gas: 39141)
ValidatePaymasterUserOpTest:test_revertsIfNonceUsed() (gas: 103502)
ValidatePaymasterUserOpTest:test_revertsIfWithdrawAssetNotZero() (gas: 55952)
ValidatePaymasterUserOpTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 100800, ~: 100992)
ValidatePaymasterUserOpTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 100793, ~: 100992)
ValidateTest:test_receive() (gas: 14687)
WithdrawGasExcess:test_RevertsIfNoExcess(uint256) (runs: 256, μ: 71122, ~: 71396)
WithdrawGasExcess:test_transferExcess(uint256,uint256,uint256) (runs: 256, μ: 104279, ~: 104290)
WithdrawTest:test_emitsCorrectly(address,uint256,uint256) (runs: 256, μ: 118270, ~: 121368)
WithdrawTest:test_emitsCorrectlyERC20Withdraw(address,uint256,uint256) (runs: 256, μ: 162408, ~: 164773)
WithdrawGasExcess:test_RevertsIfNoExcess(uint256) (runs: 256, μ: 71133, ~: 71396)
WithdrawGasExcess:test_transferExcess(uint256,uint256,uint256) (runs: 256, μ: 104290, ~: 104290)
WithdrawTest:test_emitsCorrectly(address,uint256,uint256) (runs: 256, μ: 118193, ~: 121368)
WithdrawTest:test_emitsCorrectlyERC20Withdraw(address,uint256,uint256) (runs: 256, μ: 162446, ~: 164773)
WithdrawTest:test_recordsNonceUsed(uint256) (runs: 256, μ: 111372, ~: 112461)
WithdrawTest:test_revertsIfExpired(uint48,uint256) (runs: 256, μ: 61664, ~: 61785)
WithdrawTest:test_revertsIfExpired(uint48,uint256) (runs: 256, μ: 61675, ~: 61785)
WithdrawTest:test_revertsIfNonceUsed() (gas: 95844)
WithdrawTest:test_revertsIfWrongSignature() (gas: 63830)
WithdrawTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 85143, ~: 85096)
WithdrawTest:test_reverts_whenWithdrawExceedsMaxAllowed(uint256,uint256,uint256) (runs: 256, μ: 85154, ~: 85096)
WithdrawTest:test_transfersERC20Successfully(uint256) (runs: 256, μ: 140626, ~: 143066)
WithdrawTest:test_transfersETHSuccessfully(uint256) (runs: 256, μ: 91692, ~: 93689)
7 changes: 3 additions & 4 deletions src/MagicSpend.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ contract MagicSpend is Ownable, IPaymaster {
///
/// @dev Only applies to native asset withdraws.
/// @dev Helps prevent withdraws in the same transaction leading to reverts and hurting paymaster reputation.
/// @dev Percent in whole units; 20 = 1/20 = 20%
/// @dev Percent expressed in whole units, e.g. 20 means no single withdraw
/// can exceed 20% of address.balance
uint256 public maxWithdrawPercent;

/// @notice Track the ETH available to be withdrawn per user.
Expand Down Expand Up @@ -262,9 +263,7 @@ contract MagicSpend is Ownable, IPaymaster {
///
/// @dev Reverts if not called by the owner of the contract.
///
/// @param newPercent The new value for maxWithdrawPercent
/// Percent expressed in whole units, e.g. 20 means no single withdraw
/// can exceed 20% of address.balance
/// @param newPercent The new value for maxWithdrawPercent.
function setMaxWithdrawPercent(uint256 newPercent) external onlyOwner {
_setMaxWithdrawPercent(newPercent);
}
Expand Down

0 comments on commit e5efda2

Please sign in to comment.