Skip to content

Commit

Permalink
revert Account support for batches
Browse files Browse the repository at this point in the history
  • Loading branch information
Amxx committed Dec 20, 2024
1 parent 113f9c9 commit 88e7eb0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 44 deletions.
10 changes: 1 addition & 9 deletions contracts/account/Account.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ pragma solidity ^0.8.20;
import {ERC721Holder} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import {ERC1155Holder} from "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import {ERC7739Signer} from "../utils/cryptography/ERC7739Signer.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {Multicall} from "@openzeppelin/contracts/utils/Multicall.sol";
import {AccountCore} from "./AccountCore.sol";

/**
Expand All @@ -18,10 +16,4 @@ import {AccountCore} from "./AccountCore.sol";
* NOTE: To use this contract, the {ERC7739Signer-_rawSignatureValidation} function must be
* implemented using a specific signature verification algorithm. See {SignerECDSA}, {SignerP256} or {SignerRSA}.
*/
abstract contract Account is AccountCore, Multicall, ERC721Holder, ERC1155Holder, ERC7739Signer {
function execute(address target, uint256 value, bytes calldata data) public virtual onlyEntryPointOrSelf {
// we cannot use `Address.functionCallWithValue` here as it would revert on EOA targets
(bool success, bytes memory returndata) = target.call{value: value}(data);
Address.verifyCallResult(success, returndata);
}
}
abstract contract Account is AccountCore, ERC721Holder, ERC1155Holder, ERC7739Signer {}
35 changes: 0 additions & 35 deletions test/account/Account.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@ function shouldBehaveLikeAccountExecutor({ deployable = true } = {}) {
[to.target ?? to.address ?? to, value ?? 0, calldata ?? '0x'],
),
]);

this.encodeUserOpCalldataBatch = (...calls) =>
this.mock.interface.encodeFunctionData('multicall', [
calls.map(({ to, value, calldata }) =>
this.mock.interface.encodeFunctionData('execute', [
to.target ?? to.address ?? to,
value ?? 0,
calldata ?? '0x',
]),
),
]);
});

it('should revert if the caller is not the canonical entrypoint or the account itself', async function () {
Expand Down Expand Up @@ -272,30 +261,6 @@ function shouldBehaveLikeAccountExecutor({ deployable = true } = {}) {
);
expect(this.mock.getNonce()).to.eventually.equal(1);
});

it('should support batch execution using multicall', async function () {
const value1 = 43374337n;
const value2 = 69420n;

const operation = await this.mock
.createUserOp({
callData: this.encodeUserOpCalldataBatch(
{ to: this.other, value: value1 },
{
to: this.target,
value: value2,
calldata: this.target.interface.encodeFunctionData('mockFunctionExtra'),
},
),
})
.then(op => this.signUserOp(op));

expect(this.mock.getNonce()).to.eventually.equal(0);
const tx = entrypoint.handleOps([operation.packed], this.beneficiary);
await expect(tx).to.changeEtherBalances([this.other, this.target], [value1, value2]);
await expect(tx).to.emit(this.target, 'MockFunctionCalledExtra').withArgs(this.mock, value2);
expect(this.mock.getNonce()).to.eventually.equal(1);
});
});
});
}
Expand Down

0 comments on commit 88e7eb0

Please sign in to comment.