Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clear && forge fmt && forge snapshot --isolate --match-contract Benchmark --via-ir && git add snapshots
Comment thread
Dargon789 marked this conversation as resolved.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/account.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1,698 changes: 1,698 additions & 0 deletions .idea/caches/deviceStreaming.xml

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/copilot.data.migration.ask2agent.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/markdown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions test/Benchmark.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1806,6 +1806,52 @@ contract BenchmarkTest is BaseTest {
assertEq(paymentToken.balanceOf(address(0xbabe)), 1 ether);
}

function testERC20TransferViaPortoOrchestratorWithPasskey() public {
vm.pauseGasMetering();

PassKey memory k = _randomSecp256k1PassKey();

DelegatedEOA memory d = _randomEIP7702DelegatedEOA();
vm.deal(d.eoa, type(uint128).max);
_mint(address(paymentToken), d.eoa, type(uint128).max);

vm.startPrank(d.eoa);
d.d.authorize(k.k);
d.d.setCanExecute(
k.keyHash, address(paymentToken), bytes4(keccak256("transfer(address,uint256)")), true
);
d.d.setSpendLimit(
k.keyHash, address(paymentToken), GuardedExecutor.SpendPeriod.Hour, type(uint256).max
);
d.d.setSpendLimit(k.keyHash, address(0), GuardedExecutor.SpendPeriod.Hour, type(uint256).max);
vm.stopPrank();

Orchestrator.Intent memory u;
u.eoa = d.eoa;
u.nonce = 0;
u.combinedGas = 1000000;
u.prePaymentAmount = 0 ether;
u.prePaymentMaxAmount = 0 ether;
u.totalPaymentAmount = 0.01 ether;
u.totalPaymentMaxAmount = 0.1 ether;
u.paymentToken = address(0);
// To maintain parity with the old benchmarks.
u.paymentRecipient = address(oc);
u.executionData = _transferExecutionData(address(paymentToken), address(0xbabe), 1 ether);
u.signature = _sig(k, u);

bytes[] memory encodedIntents = new bytes[](1);
encodedIntents[0] = abi.encode(u);

vm.resumeGasMetering();

oc.execute(encodedIntents);

vm.pauseGasMetering();
assertEq(paymentToken.balanceOf(address(0xbabe)), 1 ether);
vm.resumeGasMetering();
}

function testERC20TransferDirect() public {
DelegatedEOA memory d = _randomEIP7702DelegatedEOA();
_giveAccountSomeTokens(d.eoa);
Expand Down
Loading