Skip to content

Commit

Permalink
Use Zerodev's 'execute' signature
Browse files Browse the repository at this point in the history
  • Loading branch information
forshtat committed Apr 8, 2024
1 parent 7412679 commit 0e7c3c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions contracts/samples/SimpleAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ contract SimpleAccount is BaseAccount, TokenCallbackHandler, UUPSUpgradeable, In
_call(dest, value, func);
}

enum Operation {
Call,
DelegateCall
}

function execute(address to, uint256 value, bytes memory data, Operation _operation) external payable {

}

/**
* execute a sequence of transactions
*/
Expand Down
6 changes: 6 additions & 0 deletions gascalc/7-zerodev-kernel-lite.gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ context.only('simple account', function () {
console.log('zerodevKernelOwner= ', zerodevKernelOwner.address)
await g.insertAccount(zkLite0, zerodevKernelOwner)
await g.insertAccount(zkLite1, zerodevKernelOwner)
GasCheckCollector.inst.setContractName(zkLite0, 'ERC1967Proxy')
GasCheckCollector.inst.setContractName(zkLite1, 'ERC1967Proxy')
// todo: read this from deployed
GasCheckCollector.inst.setContractName('0x0aB1A1Dfb7FAa89aCE93c489120F5a8b602B1a99', 'ECDSAValidator')
GasCheckCollector.inst.setContractName('0x3fb14a424e5beD8E6ba066913fDA7882Aa2E1A58', 'KernelLiteECDSA')
GasCheckCollector.inst.setContractName('0xB668C3f3D2155d8b37F9a6483d79570FC8659c52', 'KernelFactory')

await ethers.provider.getSigner().sendTransaction({ to: zkLite0, value: 1e18.toString() })
await ethers.provider.getSigner().sendTransaction({ to: zkLite1, value: 1e18.toString() })
Expand Down
3 changes: 2 additions & 1 deletion gascalc/GasChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ export class GasChecker {

// generate the "exec" calldata for this account
accountExec (dest: string, value: BigNumberish, data: string): string {
return this.accountInterface.encodeFunctionData('execute', [dest, value, data])
// return this.accountInterface.encodeFunctionData('execute', [dest, value, data])
return this.accountInterface.encodeFunctionData('execute(address,uint256,bytes,uint8)', [dest, value, data, 0])
}

// generate the account "creation code"
Expand Down

0 comments on commit 0e7c3c5

Please sign in to comment.