diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/account.iml b/.idea/account.iml new file mode 100644 index 00000000..1ba0d660 --- /dev/null +++ b/.idea/account.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml new file mode 100644 index 00000000..cc4b430a --- /dev/null +++ b/.idea/caches/deviceStreaming.xml @@ -0,0 +1,1698 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 00000000..4bec4ea8 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,117 @@ + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 00000000..a55e7a17 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/copilot.data.migration.ask2agent.xml b/.idea/copilot.data.migration.ask2agent.xml new file mode 100644 index 00000000..1f2ea11e --- /dev/null +++ b/.idea/copilot.data.migration.ask2agent.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/markdown.xml b/.idea/markdown.xml new file mode 100644 index 00000000..c61ea334 --- /dev/null +++ b/.idea/markdown.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..4ae0bf91 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..1995e14d --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/Benchmark.t.sol b/test/Benchmark.t.sol index 2ce04524..13cbfcc1 100644 --- a/test/Benchmark.t.sol +++ b/test/Benchmark.t.sol @@ -1805,6 +1805,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);